0
Follow
0
View

Unable to handle the Login page on naukri.com

xiaoyudgx 注册会员
2023-01-24 20:52

xPath is not valid one. There is a typo in your xPath. Please use below,

//input[@placeholder='Enter your password']

Always check the xPath in chrome console.

Open web page -> Inspect element/Press F12 -> Go to elements tab -> Ctrl + F -> Place your xPath

If it is a valid and unique one you should see 1/1 result and element will be highlighted.

dongshengye77 注册会员
2023-01-24 20:52

The locators you are using it here :

 WebElement username = wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//input[@plcaeholder='Enter your active Email ID / Username']"))));
 WebElement password = wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//input[@plcaeholder='Enter your password']"))));

looks brittles since they are totally dependent on placeholder text.

Please use below locator :

for username :

//label[contains(text(),'Username')]//following-sibling::input

for password :

//label[contains(text(),'Password')]//following-sibling::input

Your code should look like this :

WebElement username = wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//label[contains(text(),'Username')]//following-sibling::input"))));
WebElement password = wait.until(ExpectedConditions.visibilityOfElementLocated((By.xpath("//label[contains(text(),'Password')]//following-sibling::input"))));
username.sendKeys("naukriuser@gmail.com");
password.sendKeys("123456");

About the Author

Question Info

Publish Time
2023-01-24 20:51
Update Time
2023-01-24 20:51

Related Question

IDE Tomcat链接不上了

AUTO_INCREMENT在MySQL项目中不工作

关于#centos#删除文件夹问题

HasVirtualAuthenticator未找到

在使用Xcode 13的iOS 15模拟中,UITableView scrolltorowatindexpath:atScrollPosition:animated:在单元格中显示在section头下面的结果

bertopic评估

c语言怎么判断质数和output factors

不断扫描firestore中的新文档,获取它的文档ID

====类“String”没有实例方法“toStringAsFixed”

命令错误:(MongoServerError: bad auth: Authentication failed)