Being new to Selenium and HTML, I have been working on testing a website using Selenium WebDriver. However, the driver is unable to locate an element.
Here's my code:
browser = webdriver.Chrome()
wait = WebDriverWait(browser, 10)
data = wait.until(EC.element_to_be_clickable((By.CSS_SELECTOR, '#search_result_former > div.re-content.search-mode-content > div.list-container > ul > li:nth-child(1) > div > div.item-footer > div > a:nth-child(1)')))
The HTML snippet is as follows:
<div class="btn-group clear">
<a href="javascript:;" class="btn btn-operation" role="detail">Detailed View</a>
<a href="javascript:;" class="btn btn-operation" role="lawState" an="CN201820052763" pn="CN207117855U">Legal Status</a>
<a href="javascript:;" class="btn btn-operation" role="proposor" _name="信阳农林学院;" _address=" 河南省信阳市羊山新区新24大街信阳农林学院;" _zipcode="464000;" _country="">Applicant</a>
<a href="javascript:;" role="addAnalysis" class="btn btn-operation">+ Analysis Library</a>
<a href="javascript:;" role="favorite" class="btn btn-operation">Bookmark</a>
<a href="javascript:;" role="translate" _id="CN201820052763.420180316XX" class="btn btn-operation btn-translate">Translate</a>
</div>
Upon running the code, I encounter the following error message:
*raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:*
Interestingly, I am able to visually confirm that the element has indeed finished loading. I attempted using XPATH
, but without success.