Unable to locate element: org.openqa.selenium.NoSuchElementException

Yogesh Trivedi

I am writing script for mobile number verification by One time password (OTP). While OTP popup is open, I am unable to put value in the text field, system is showing error:

org.openqa.selenium.NoSuchElementException: Unable to locate element: {"method":"class name","selector":"opt_success"} Command duration or timeout: 30.04 seconds"

Below is the code that I have drafted.

driver.findElement(By.id("phone")).sendKeys(Constants.MOBILE_NUMBER);
        driver.findElement(By.id("btn_verify")).click();
        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
        WebElement otp_value = driver.findElement(By.id("otp"));
        otp_value.sendKeys("1212121212");
        driver.findElement(By.xpath("html/body/div[4]/div/form/div/div[4]/span[1]/input")).click();

Webpage url is : http://talentrack.in/register

Srikanth Nakka

You need to correct your Xpath for "OTP text field" as below.

driver.findElement(By.xpath("//*[@id='verifyOTP_register']//*[@id='otp']")).sendKeys("1212121212");

Also, you can use 'relative' xpath for Submit button instead of using 'absolute' xpath.

driver.findElement(By.xpath("//*[@id='verifyOTP_register']//*[@type='submit']")).click();

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

org.openqa.selenium.NoSuchElementException: Unable to locate element

From Dev

Selenium Fluent Wait Implementation in the code still gives "org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element:"

From Dev

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element

From Dev

org.openqa.selenium.NoSuchElementException: Returned node (null) was not a DOM element when trying to locate card-fields-iframe by CssSelector

From Dev

org.openqa.selenium.NoSuchElementException

From Dev

NoSuchElementException - Unable to locate element

From Dev

selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:

From Dev

Selenium 'Unable to locate element'

From Dev

Unable to locate element in Selenium

From Dev

Unable to locate the element in selenium

From Dev

Getting NoSuchElementException: no such element: Unable to locate element

From Dev

NoSuchElementException: Unable to locate element in popup window

From Dev

Exception in thread "main" org.openqa.selenium.NoSuchElementException: When trying to select an element from a pop-up using selenium

From Dev

Selenium with pyvirtualdisplay unable to locate element

From Dev

Selenium - unable to locate element by classname

From Dev

Unable to locate an Element By ID in Selenium

From Dev

Unable to locate an element in Selenium (htmlUnitDriver)

From Dev

Selenium Unable to locate element (Python) WebScraping

From Dev

Selenium WebDriver: unable to locate element (C#)

From Java

Unable to locate element by xpath using Selenium with Python

From Dev

Unable to locate element error in Java-Selenium

From Dev

Selenium webdriver - unable to locate an element on youtube

From Dev

Selenium WebDriver Unable to locate element in link

From Dev

Selenium Web driver - unable to locate element

From Dev

Unable to locate the Element on Canvas using Selenium WebDriver

From Dev

Python selenium unable to locate username element

From Dev

unable to resolve class reference org/openqa/selenium/WebDriver

From Dev

error : unable to resolve class reference org/openqa/selenium/WebDriver

From Dev

org.openqa.selenium.InvalidSelectorException - [object Text]. It should be an element

Related Related

  1. 1

    org.openqa.selenium.NoSuchElementException: Unable to locate element

  2. 2

    Selenium Fluent Wait Implementation in the code still gives "org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element:"

  3. 3

    Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to locate element

  4. 4

    org.openqa.selenium.NoSuchElementException: Returned node (null) was not a DOM element when trying to locate card-fields-iframe by CssSelector

  5. 5

    org.openqa.selenium.NoSuchElementException

  6. 6

    NoSuchElementException - Unable to locate element

  7. 7

    selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element:

  8. 8

    Selenium 'Unable to locate element'

  9. 9

    Unable to locate element in Selenium

  10. 10

    Unable to locate the element in selenium

  11. 11

    Getting NoSuchElementException: no such element: Unable to locate element

  12. 12

    NoSuchElementException: Unable to locate element in popup window

  13. 13

    Exception in thread "main" org.openqa.selenium.NoSuchElementException: When trying to select an element from a pop-up using selenium

  14. 14

    Selenium with pyvirtualdisplay unable to locate element

  15. 15

    Selenium - unable to locate element by classname

  16. 16

    Unable to locate an Element By ID in Selenium

  17. 17

    Unable to locate an element in Selenium (htmlUnitDriver)

  18. 18

    Selenium Unable to locate element (Python) WebScraping

  19. 19

    Selenium WebDriver: unable to locate element (C#)

  20. 20

    Unable to locate element by xpath using Selenium with Python

  21. 21

    Unable to locate element error in Java-Selenium

  22. 22

    Selenium webdriver - unable to locate an element on youtube

  23. 23

    Selenium WebDriver Unable to locate element in link

  24. 24

    Selenium Web driver - unable to locate element

  25. 25

    Unable to locate the Element on Canvas using Selenium WebDriver

  26. 26

    Python selenium unable to locate username element

  27. 27

    unable to resolve class reference org/openqa/selenium/WebDriver

  28. 28

    error : unable to resolve class reference org/openqa/selenium/WebDriver

  29. 29

    org.openqa.selenium.InvalidSelectorException - [object Text]. It should be an element

HotTag

Archive