Exception in thread “main” org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:”name”,”selector”:”Timing Alert”}

Answered

Hi Lakshay,

First of all, thanks for the great tutorials! This is real help for beginners as well as a very good reference for selenium automation engineers.

I’m just starting to learn selenium and your tutorials are great! I am currently working on the Practice Exercise under the topic ‘Selenium WebDriver Commands’.  I am getting the following exception on running the solution code provided.

Exception in thread “main” org.openqa.selenium.NoSuchElementException: Unable to locate element: {“method”:”name”,”selector”:”Timing Alert”}

Please help me debug and resolve this error.

Thanks,
Deepa

Default Asked on November 9, 2014 in Selenium WebDriver.
Add Comment
  • 2 Answer(s)
    Best answer

    Hi Deepa

    you can try following steps to solve this problem

    1. Make Sure That Page is Loaded properly before trying to Find that Element Try Using Some Thread.sleep Before That Element

    2. Make Sure that Locater You are Using is Correct

    Regards
    Ankit Ramola

    Vice Professor Answered on November 10, 2014.
    Add Comment

    Hi Ankit,

    Thanks for the response and help.

    Few things that i did based on your suggestion

    1. I used the Thread.sleep before that element – but it did not help
    2. I carefully looked at the page (http://www.toolsqa.com/automation-practice-switch-windows/) and noticed there are elements being generated towards the bottom of the page (through a script in the page source) which is moving the button behind the div and hence it is not getting identified. This seems to be the main reason behind the elements not being identified and hence the error – I saved  copied the source code into a separate file and saved it to my local. In this copy I have removed the script that was generating the elements at the bottom of the page (For now this is viable workaround for me until i learn to handle the growing pages and elements getting hidden behind divs/or objects on the page). 
    3. The locator ‘name’ used in the example, is still not working. So I tried using ID and Xpath – with these locators  and the workaround from #2 the element is getting identified.

    Regards,
    Deepa

    Default Answered on November 10, 2014.

    Your Approach is Really Great

    on November 11, 2014.

    Hi Deepa,

    That is the new technology called Lazy loading, take a look over this article:
    http://forumsqa.com/question/help-me-to-locate-an-weblement/

    Regards,
    Lakshay Sharma

    on November 11, 2014.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.