After feeding the search bar with "Safety" keyword, I am trying to get to the page associated with this link_text. But error unable to find element is coming.

from selenium import webdriver
import pandas as pd
import re
import time
driver = webdriver.Chrome("C:\\Users\\tanmay\\Downloads\\chromedriver.exe")

print("Name :",driver.find_element_by_id("HEADING").text)
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
Element = driver.find_element_by_class_name("query_elem")
  • 1
    Is the element visible on the page when you are trying to click it. And also check if that element is not in a iframe and there is no overlay that block clicking the element.
    – chesthar
    Sep 16, 2018 at 13:43

1 Answer 1


After clicking on the search icon, there is a AJAX request to fetch the data. You would need to wait its end to query the text.

One way of doing it easily is to wait for the searchHit element to be visible.

wait = WebDriverWait(driver, 10) #10 seconds timeout
searchHit = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, ".searchHit"))) # Wait until the element is clickable for 10 seconds at most

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.