I am trying to write a list of code to automate my daily file downloading process. I am using Python Selenium for this. However, I am having trouble to locate one of the clicks.
HTMI Code as below:
<div class="card dark-blue"> <h3 data-mh="title-research" style="height: 52px;">Rated Range Prices (LT)</h3> <h4 class="disp_date">26-Jan-2021 17:47:58</h4> <div class="divider"></div> <a href="javascript:seemore('F10002');" value="F10002" class="link">See More ?</a> </div>
Here is my code:
link = driver.find_element_by_xpath("//a[@href='javascript:seemore('F10002');']")
The error msg:
InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //*[@href='javascript:seemore('F10002');'] because of the following error:
SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*[@href='javascript:seemore('F10002');']' is not a valid XPath expression.
(Session info: chrome=88.0.4324.104)
Can anyone please enlighten me on this? Many thanks.
question from:
https://stackoverflow.com/questions/65904010/error-on-python-selenium-find-element-by-xpath 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…