I am using Selenium and Chrome browser in macOS to test my code where I am entering some data in a webpages to retrieve data. I’m facing one issue where when I try to search for an element with ID, I get the following error:
Traceback (most recent call last):
File "/Users/Developer/PYTHON/SELENIUM/linkedInScrape.py", line 29, in <module>
jobQuery = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,
File "/Users/siddhu/Library/Python/3.9/lib/python/site-packages/selenium/webdriver/support/wait.py", line 105, in until
raise TimeoutException(message, screen, stacktrace)
However if I try to access the element with XPath, the compilation is successful. The code for searching with XPath is:
driver.get("https://www.linkedin.com/jobs/")
jobQuery = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH,
"//input[starts-with(@id,'jobs-search-box-keyword')]")))
The code for searching with ID is:
driver.get("https://www.linkedin.com/jobs/")
jobQuery = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"input#jobs-search-box-keyword-id-ember922"))
Is there a mistake from my side in locating the elements?