I've been tinkering with Selenium (Python) for the day working on a project. I'm stuck trying to click on a link of the webpage because I'm unable to retrieve the element by any of the ways I've found until now.
The link is this:
<p>
<a href="0_fr.asp?contenido=0actunor.asp" target="mainFrame"><font size="3" face="Arial" color="#CC9900">
<b>Base de datos de Disposiciones Vigentes</b></font></a>
</font>
</p>
Now, I've tried these things so far, and all give me NoSuchElementException:
- driver.find_element_by_css_selector("a[href=0_fr.asp?contenido=0actunor.asp]")
- driver.find_element_by_css_selector('div:contains("Base de datos de Disposiciones Vigentes")')
- same as 1) but copying and pasting CSS selector alone as a String
- by link text and partial link text using the content between and
- by using id just in case it does something.
And several more found across other StackOverflow questions and online guides to build my own css selectors and such, but I don't know any HTML or CSS so it's been a bit difficult to follow them. I can provide more information if needed, but i'm unable to link the webpage as you would have to log in and it's a job thing.
Any help or places to search for more information are greatly welcome!
SOLVED: The problem was that the link was inside a frame, which was inside another frame. I just hade to use driver.switch_to.frame("frameName") twice, then use css_selector normally and works as it should.