0

I'm trying to solve this:

<label class='blah' style='bbb'>
    <input class='input_trello klaus black_mage' type='mail' place-holder='placeIt' name='name' id='myid'>

What I need is to write in the input using Selenium, everytime that I try to take it as Xpath, id or name it can't find it in HTML.

selenium.common.exceptions.NoSuchElementException: Message: no such
element: Unable to locate element: {"method":"id","selector":"myid"}

Trying by xpath:

selenium.common.exceptions.NoSuchElementException: Message: no such 
element: Unable to locate element: {"method":"xpath","selector":"//*[@id="myid"]"}

Clan anyone give me a light in this darkness?

2
  • 1
    Do you have an implicit wait added so that the page waits to ensure the element is available, other wise an explicit wait could be a good option. seleniumhq.org/docs/04_webdriver_advanced.jsp Commented Feb 25, 2016 at 19:33
  • @Tbizzness, thank you! It was the answer! When I moved to another page I forgot to wait a few seconds until de HTML loads. Commented Feb 25, 2016 at 19:39

1 Answer 1

1

As @Tbaker said, just needed to input a implicit wait on It's values:

driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

to wait until the HTML loads and now it would work perfectly after getting to the new page.

Sign up to request clarification or add additional context in comments.

1 Comment

Using time.sleep() is not the correct approach. Read @tbizzness comment again. He is talking about using implicit and/or explicit waits.

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.