I'm trying to find the destination input box on the Google Flights page using Selenium. The box itself doesn't have any useful identifiers (unless selenium can us jsname to find elements). Right now I'm using a locator to make selenium choose between two c-wiz boxes and I get this error:
selenium.common.exceptions.InvalidArgumentException: Message: invalid argument: 'using' must be a string
I guess I'm not exactly sure how to use a relative locator? My ultimate goal is to get Selenium to send the text "JFK" to the destination input box on https://www.google.com/travel/flights so if anyone has a more elegant approach I'm all ears :)
Here's my code for reference:
bigWiz = bigBody.find_elements(wizLoc)"
is throwing the error:
Code trials:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import locate_with
driver_service = Service(executable_path = '/path/chromedriver')
url = 'https://www.google.com/travel/flights'
browser = webdriver.Chrome(service = driver_service)
browser.get(url)
bigBody = browser.find_element(By.ID,'yDmH0d')
wrongWiz = bigBody.find_element(By.ID, 'ow4')
wizLoc = browser.find_element(locate_with(By.TAG_NAME, 'c-wiz').below(wrongWiz))
bigWiz = bigBody.find_elements(wizLoc)