Hi Team,
I am trying to run the below script but getting exception on the red highlighted line. Not sure why that exception is happening and really struck up and not able to proceed further. I have attached the exception error also below. Please help
Script
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class InterAFT_DDF1 {
public static void main (String[] args) throws InterruptedException {
System.setProperty(“webdriver.chrome.driver”,”C:\\Selenium\\chromedriver.exe”);
WebDriver myDriver = new ChromeDriver();
myDriver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String vUrl,vLoginUser, vLoginPwd,vUserName,VFirstName,vLastName,vEmail,vCourse;
vUrl = “http://test.atomic77.in/INTEv1/app/”;
vLoginUser =”xxxxxx”;
vLoginPwd = “xxxxxx”;
vUserName = “drajendran0”;
VFirstName = “abc0”;
vLastName = “def0”;
vEmail=”rdine...@gmail.com”;
vCourse=”SLTPAug2016″;
//Launching an application
myDriver.get(vUrl);
//Logon to application using credentials
myDriver.findElement(By.linkText(“Login”)).click();
myDriver.findElement(By.xpath(“//input[@id=’user_login’]”)).clear();
myDriver.findElement(By.xpath(“//input[@id=’user_login’]”)).sendKeys(vLoginUser);
myDriver.findElement(By.xpath(“//input[@id=’user_pass’]”)).clear();
myDriver.findElement(By.xpath(“//input[@id=’user_pass’]”)).sendKeys(vLoginPwd);
myDriver.findElement(By.cssSelector(“button.submit”)).click();
//Check login is successful
if(!myDriver.findElements(By.linkText(“Send New Notification”)).isEmpty()) {
System.out.println(“Login is successful”);
}else
System.out.println(“Login is not successful”);
myDriver.close();
{
Thread.sleep(5000);
//Click New Trainee hyperlink
myDriver.findElement(By.linkText(“Trainees”)).click();
//Check if trainer access is successful
if(!myDriver.findElements(By.xpath(“//input[@value=’Create’]”)).isEmpty()) {
System.out.println(“Navigation to Add Trainees page is successful”);
}else
System.out.println(“Navigation to Add Trainees page is not successful”);
myDriver.close();
}
//Add the trainee details
myDriver.findElement(By.xpath(“//input[@name=’custom_user_name’]”)).sendKeys(vUserName);
myDriver.findElement(By.xpath(“//input[@name=’custom_first_name’]”)).sendKeys(VFirstName);
myDriver.findElement(By.xpath(“//input[@name=’custom_last_name’]”)).sendKeys(vLastName);
myDriver.findElement(By.xpath(“//input[@name=’custom_email_name’]”)).sendKeys(vEmail);
myDriver.findElement(By.xpath(“//input[@class=’select2-search_field’]”)).click();
myDriver.findElement(By.xpath(“//input[@value=’Create’ and @type=’submit’]”)).click();
//Check trainee is successfully created
}
}
Console log
Starting ChromeDriver 2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed) on port 23037
Only local connections are allowed.
Nov 27, 2016 8:41:59 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
Nov 27, 2016 8:42:01 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Login is successful
Exception in thread "main" org.openqa.selenium.NoSuchSessionException: no such session
(Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'RAJENDDI4', ip: '192.168.1.4', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_111'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed), userDataDir=C:\Users\rajenddi\AppData\Local\Temp\scoped_dir3228_17396}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=54.0.2840.99, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 7be921b5cc16c63d2bed90a726fca504
*** Element info: {Using=link text, value=Trainees}
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:368)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByLinkText(RemoteWebDriver.java:425)
at org.openqa.selenium.By$ByLinkText.findElement(By.java:246)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:360)
at InterAFT_DD2.main(InterAFT_DD2.java:56)
[1.006][INFO]: Launching chrome: /root/build/chromium-latest-linux/latest/chrome --disable-background-networking --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --disable-gpu --disable-hang-monitor --disable-infobars --disable-popup-blocking --disable-prompt-on-repost --disable-setuid-sandbox --disable-sync --disable-web-resources --dom-automation --enable-experimental-extension-apis --enable-logging --full-memory-crash-report --homepage=about:blank --ignore-certificate-errors --load-extension=/root/binaryage/dirac/resources/release,/root/binaryage/dirac/test/marion/resources/unpacked,/tmp/.org.chromium.Chromium.Mfl7T3/internal --log-level=0 --metrics-recording-only --no-default-browser-check --no-first-run --no-sandbox --password-store=basic --remote-debugging-port=12777 --safebrowsing-disable-auto-update --test-type=webdriver --use-mock-keychain --user-data-dir=/tmp/.org.chromium.Chromium.1E6BNI data:,
[1.006][DEBUG]: DevTools request: http://localhost:12777/json/version
/root/build/chromium-latest-linux/latest/chrome: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory
Hi Dinesh |