Skip to content
Advertisement

Selenium returns NoSuchElementException Error

I`m a newbie to python. Recently I got interested in Web Crawling.

Today I got stuck in NoSuchElementException

This is the webpage that i want to scrape.

enter image description here

When I click the username that i erased, it returns box like this.

enter image description here

Though I used the xpath that i copied from Chrome developer tool, it returns me NoSuchElementException:

JavaScript

HTML is like this

JavaScript

My code is just like this,

JavaScript

I checked there is this xpath, but when I get it into .find_element_by_xpath() method it returns Error.

I do really share the webpage, but it needs to log-in to get there, So i cannot share the webpage.

Could you guess what might cause this problem?

I checked time is not the problem. I checked iframe is not the problem.

Thank you in advance Have a great day!

Advertisement

Answer

To locate the element with text as 이주연마인 you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following Locator Strategies:

  • Using LINK_TEXT:

    JavaScript
  • Using CSS_SELECTOR:

    JavaScript
  • Using XPATH:

    JavaScript
  • Note: You have to add the following imports :

    JavaScript

References

You can find a couple of relevant discussions on NoSuchElementException in:

Advertisement