Home > Enterprise >  Cannot find the Xpath
Cannot find the Xpath

Time:12-24

Webpage i want to test

For this username and password field what will be the Xpath. I am using this below Code

When i send keys using those xpath, username and password won't taking any input

I am trying to put values in username and password using stable selectors in selenium.

CodePudding user response:

The main thing I would suggest here is using ChroPath, it helps get the exact rel Xpath. You could use the class name as you have shown but if you want the xpath I would recommend using "//body/div[1]/div[7]/div[6]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/form[1]/div[1]/input[1]" for the Account Name, and "//body/div[1]/div[7]/div[6]/div[1]/div[1]/div[1]/div[1]/div[1]/div[2]/div[1]/form[1]/div[2]/input[1]" for the password.

CodePudding user response:

You can try the below locators:

for username textfield:

.//input[@type='text' and @class='newlogindialog_TextInput_2eKVn']

for password textfield:

.//input[@type='password' and @class='newlogindialog_TextInput_2eKVn']

for sign-in button:

.//button[@type='submit' and @class='newlogindialog_SubmitButton_2QgFE']

Practice more on XPath and other locators, always prefer Relative XPath, don't use Absolute XPath.

Next time, post your question clearly, not using images.

  • Related