Hi All,
I'm unable to locate Chropath extension for locating elements by.xpath. But chropath comes in Chromebrowser. Any solution
Sending script.
driver.get("https://www.edureka.co/angular-training");
driver.manage().window().maximize();
//************Submitting Student data*****************//
driver.findElement(By.name("name")).sendKeys("John");
driver.findElement(By.name("contact")).sendKeys("123456");
Select drpsubject=new Select(driver.findElement(By.name("subject")));
drpsubject.selectByVisibleText("JS");
driver.findElement(By.name("marks")).sendKeys("100");
driver.findElement(By.cssSelector("input[type=button]")).click();
//********Verify data in the table after submitting***********
WebElement table=driver.findElement(By.xpath("//table[@class='table table-bordered']"));
String name=table.findElement(By.xpath("//td[2]")).getText();
String contact=table.findElement(By.xpath("//td[3]")).getText();
String subject=table.findElement(By.xpath("td[4]")).getText();
String marks=table.findElement(By.xpath("//td[5]")).getText();
String edit=table.findElement(By.xpath("//td[6]")).getText();
String delete=table.findElement(By.xpath("//td[7]")).getText();
if(name.equals("John") && contact.equals("123456") && subject.equals("JS") && marks.equals("100"))
{
System.out.println("Submit student data - Passed");
}
else
{
System.out.println("Submit student data - Failed");
}
xception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"td[4]"}
(Session info: chrome=87.0.4280.66)
For documentation on this error, please visit: https://www.seleniumhq.org/exceptions/no_such_element.html
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'DESKTOP-D0DRPFI', ip: '192.168.1.72', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '15.0.1'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 87.0.4280.66, chrome: {chromedriverVersion: 86.0.4240.22 (398b0743353ff..., userDataDir: C:\Users\mailf\AppData\Loca...}, goog:chromeOptions: {debuggerAddress: localhost:58402}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: WINDOWS, platformName: WINDOWS, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify, webauthn:virtualAuthenticators: true}
Session ID: a5a3997e69ce1f4e31abe6ee218ed6c2
*** Element info: {Using=xpath, value=td[4]}
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)