I have below requirement to do the automation using selenium and python. Can someone please help me with the code:

  1. Enter the exact query string in the search box
  2. In the auto-suggest, the exact name is appearing as a suggestion.
  3. Manually the way it works is, if I click the auto-suggested option, then the new webpage opens.

I am stuck in step3.

My code is:

search_query = 'enter search string'
driver = webdriver.Chrome('C:\\chromedriver\\chromedriver.exe') 
driver.get("enter website name")
search_textbox = driver.find_element_by_xpath("//*[@id='txtCompanySearch']")   #XPATH can be found with developer tools in browsers
  • 1 - What is the error? 2 - Is the field well-loaded? A explicity wait may be necessary. (I can transform this comment in answer if that's is the problem) – João Farias Feb 22 '19 at 5:59
  • Are you trying to navigate to the application? – Jitendra Jogeshwar Feb 22 '19 at 6:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.