I keep getting the error that says:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div/div/div/div[2]/div/div/div/div[2]/div/div/form/input"}
I am working on this website, https://new.igashop.com.au/. What I am trying to do is to extract the city I want from the google sheet and type it into the search bar so that I can access the website for that particular city. I cannot find what is wrong with my code. Could anyone give me any advice? Thanks
driver = get_webdriver()
driver.delete_all_cookies()
driver.implicitly_wait(10)
driver.get("https://new.igashop.com.au/")
city = product_sheet.col_values(2)[index]
search_bar = driver.find_element_by_xpath('/html/body/div[2]/div/div/div/div[2]/div/div/div/div[2]/div/div/form/input')
search_bar.send_keys(city)
search_bar.send_keys(Keys.RETURN)
I am assuming, you do not have problem in getting the city name correctly. If that's working fine, then below code is able to type "city name" inside the search field and then click on it.
Example cityName: "Japan"
driver.find_element(By.ID, "desktop-searchInputBox").send_keys("Japan")
driver.find_element(By.CSS_SELECTOR, "#desktop-searchInputButton svg").click()
Output: