0

I am trying to web scrape a website using Selenium, and there is an anchor element that I need to click that that has an href of: javascript:void(0)

If you want to see the website for yourself, I am trying to click on the "I accept" button: http://www.collierappraiser.com/index.html?ref=/main_search/RecordDetail.html&ccpaver=1707221124&dl=yes&sid=901496001&ccpaver=1707221124&FolioID=62428180003

I have tried a couple of things, first: browser.find_element_by_link_text('I Accept').click() I get cannot find element error.

I have also tried finding the element by selector and XPath and it still yields the same error.

I have tried executing js like so: browser.execute_script("document.getElementsByTagName('a')[0].click();") and it gives me a cannot read property of undefined error.

Please help!

1
  • When you visit the website normally, can you click on the link and go somewhere? Or do you have to do something else first? Hint: what does the "I accept" label refer to? Commented May 25, 2020 at 2:05

1 Answer 1

1

While inspecting the element observed that there is an iframe embedded on the page which holds your element.

enter image description here

Required to switch into the frame to access the element inside.

Refer below code:

driver.switch_to.frame("rbottom")
driver.find_element_by_id("a_searchlink").click()
Sign up to request clarification or add additional context in comments.

2 Comments

I tried to do a little research into frames, but my knowledge of HTML is limited. Could you explain frames like I'm 5?

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.