Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
added 1719 characters in body
Source Link
kaushik3993
  • 61
  • 1
  • 2
  • 5

Code:

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.support.ui.Select;
public class Trial {
public static void main(String[] args) throws ClassNotFoundException {

System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\Gecko\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("SeleniumProfile");
WebDriver driver=new FirefoxDriver(myprofile);
driver.get("http://10.235.80.98:8080/digite/Request?Key=siteadm_login");
driver.findElement(By.xpath("//*[@id='loginId']")).sendKeys("admin");
driver.findElement(By.xpath("//*[@id='password']")).sendKeys("111111");
WebElement button=driver.findElement(By.xpath("html/body/div[1]/section/div/div/div/form/p[3]/input"));
JavascriptExecutor executor = (JavascriptExecutor) driver;
            executor.executeScript("arguments[0].click();", button);
Thread.sleep(5000);
Select URLSelect=new Select(driver.findElement(By.id("selectURL")));
URLSelect.selectByValue("Integration Console");
Select jobSelect=new Select(driver.findElement(By.xpath("//*[@id='job']")));
jobSelect.selectByValue("Wipro Project Pre Process Adaptor");
driver.findElement(By.xpath("//*[@id='showSync_7004']")).click();
driver.quit();
} catch (Exception e) {
e.printStackTrace();
}
}
}

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

Code:

import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
import org.openqa.selenium.support.ui.Select;
public class Trial {
public static void main(String[] args) throws ClassNotFoundException {

System.setProperty("webdriver.gecko.driver", "D:\\Selenium\\Gecko\\geckodriver.exe");
ProfilesIni profile = new ProfilesIni();
FirefoxProfile myprofile = profile.getProfile("SeleniumProfile");
WebDriver driver=new FirefoxDriver(myprofile);
driver.get("http://10.235.80.98:8080/digite/Request?Key=siteadm_login");
driver.findElement(By.xpath("//*[@id='loginId']")).sendKeys("admin");
driver.findElement(By.xpath("//*[@id='password']")).sendKeys("111111");
WebElement button=driver.findElement(By.xpath("html/body/div[1]/section/div/div/div/form/p[3]/input"));
JavascriptExecutor executor = (JavascriptExecutor) driver;
            executor.executeScript("arguments[0].click();", button);
Thread.sleep(5000);
Select URLSelect=new Select(driver.findElement(By.id("selectURL")));
URLSelect.selectByValue("Integration Console");
Select jobSelect=new Select(driver.findElement(By.xpath("//*[@id='job']")));
jobSelect.selectByValue("Wipro Project Pre Process Adaptor");
driver.findElement(By.xpath("//*[@id='showSync_7004']")).click();
driver.quit();
} catch (Exception e) {
e.printStackTrace();
}
}
}

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

added 2355 characters in body
Source Link
kaushik3993
  • 61
  • 1
  • 2
  • 5

I'm trying to access a select HTML element using Selenium WebDriver. But I'm getting a org.openqa.selenium.NoSuchElementException. This is happening only while handling elements inside a table. Otherwise elements are located easily.

Xpath I'm using:

Select URLSelect=new Select(driver.findElement(By.xpath("//table/tbody/tr/td[1]/select")));
URLSelect.selectByValue("Integration Console");

Screenshot of firepath console:   

enter image description here

Console data:

org.openqa.selenium.NoSuchElementException: Unable to locate element: //table/tbody/tr/td[1]/select
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'D-113102687', ip: '10.200.214.51', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\KA318963\AppData\Local\Temp\rust_mozprofile.WRaqhIjIbR05, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.2, platformVersion=10.0, moz:processID=11756.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: bcddd003-0d0a-43e6-8c10-98cbf91d5c43
*** Element info: {Using=xpath, value=//table/tbody/tr/td[1]/select}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:410)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:402)
    at Trial.main(Trial.java:225)

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

I'm trying to access a select HTML element using Selenium WebDriver. But I'm getting a org.openqa.selenium.NoSuchElementException. This is happening only while handling elements inside a table. Otherwise elements are located easily.

Xpath I'm using:

Select URLSelect=new Select(driver.findElement(By.xpath("//table/tbody/tr/td[1]/select")));
URLSelect.selectByValue("Integration Console");

Screenshot of firepath console:  enter image description here

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

I'm trying to access a select HTML element using Selenium WebDriver. But I'm getting a org.openqa.selenium.NoSuchElementException. This is happening only while handling elements inside a table. Otherwise elements are located easily.

Xpath I'm using:

Select URLSelect=new Select(driver.findElement(By.xpath("//table/tbody/tr/td[1]/select")));
URLSelect.selectByValue("Integration Console");

Screenshot of firepath console: 

enter image description here

Console data:

org.openqa.selenium.NoSuchElementException: Unable to locate element: //table/tbody/tr/td[1]/select
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'D-113102687', ip: '10.200.214.51', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_60'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities [{moz:profile=C:\Users\KA318963\AppData\Local\Temp\rust_mozprofile.WRaqhIjIbR05, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=false, browserVersion=53.0.2, platformVersion=10.0, moz:processID=11756.0, browserName=firefox, javascriptEnabled=true, platformName=windows_nt}]
Session ID: bcddd003-0d0a-43e6-8c10-98cbf91d5c43
*** Element info: {Using=xpath, value=//table/tbody/tr/td[1]/select}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
    at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:410)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:402)
    at Trial.main(Trial.java:225)

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.

Source Link
kaushik3993
  • 61
  • 1
  • 2
  • 5

No such element exception while handling elements inside tables in Selenium Webdriver

I'm trying to access a select HTML element using Selenium WebDriver. But I'm getting a org.openqa.selenium.NoSuchElementException. This is happening only while handling elements inside a table. Otherwise elements are located easily.

Xpath I'm using:

Select URLSelect=new Select(driver.findElement(By.xpath("//table/tbody/tr/td[1]/select")));
URLSelect.selectByValue("Integration Console");

Screenshot of firepath console: enter image description here

I have tried absolute xpath also for the same. But nothing I've tried seems to work. Help.