selenium webdriver in Internet Explorer throwing an error even after done all required setting - selenium

public class FirstTest { WebDriver driver; #Test public void test() { System.setProperty("webdriver.ie.driver","C:\\Users\\Priyanka\\Documents\\datadriver\\IEDriverServer.exe"); driver=new InternetExplorerDriver(); //driver=new FirefoxDriver(); driver.manage().window().maximize(); driver.get("http://gmail.com"); driver.findElement(By.id("userid")).sendKeys("Abc#gmail.coms"); driver.findElement(By.id("pwd")).sendKeys("abc#167"); driver.findElement(By.name("Submit")).click(); } }
This is my code.It will open the given URL but thows an error when trying to find webelement Error message:
FAILED: test org.openqa.selenium.NoSuchWindowException: Unable to find
element on closed window (WARNING: The server did not provide any
stacktrace information) Command duration or timeout: 28 milliseconds
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09
19:55:52' System info: host: 'Priyanka-PC', ip: '100.74.201.94',
os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1',
java.version: '1.7.0_79' *** Element info: {Using=id, value=userid}
Session ID: fc075a9b-5a50-42fa-ba96-ce2258254d4a Driver info:
org.openqa.selenium.ie.InternetExplorerDriver Capabilities
[{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0,
ignoreZoomSetting=false, enablePersistentHover=true,
ie.ensureCleanSession=false, browserName=internet explorer,
enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss,
version=-1, pageLoadStrategy=normal, ie.usePerProcessProxy=false,
cssSelectorsEnabled=true, ignoreProtectedModeSettings=false,
requireWindowFocus=false, initialBrowserUrl=http://localhost:22334/,
handlesAlerts=true, ie.forceCreateProcessApi=false, nativeEvents=true,
browserAttachTimeout=0, ie.browserCommandLineSwitches=,
takesScreenshot=true}] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at
org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at
org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at
org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:353)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementById(RemoteWebDriver.java:403)
at org.openqa.selenium.By$ById.findElement(By.java:218) at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:345)
at demo.FirstTest.test(FirstTest.java:20) at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606) at
org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:643) at
org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820) at
org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128) at
org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at
org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:782) at
org.testng.TestRunner.run(TestRunner.java:632) at
org.testng.SuiteRunner.runTest(SuiteRunner.java:366) at
org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361) at
org.testng.SuiteRunner.privateRun(SuiteRunner.java:319) at
org.testng.SuiteRunner.run(SuiteRunner.java:268) at
org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at
org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at
org.testng.TestNG.runSuitesSequentially(TestNG.java:1246) at
org.testng.TestNG.runSuitesLocally(TestNG.java:1171) at
org.testng.TestNG.run(TestNG.java:1066) at
org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:113) at
org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:206) at
org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:177)
I have done below settings:
Set Security zone
Made entry in Registry file
Set environment variable
Set default zoom size to 100 Please guide what should i do.
This code is working fine in firefox

Try this.
Enable protected mode for all zones in IE browser. It should be checked for all zones.
It worked for me.

Related

NosuchelementException while launching Google page with Chrome headless browser in Selenium [duplicate]

This question already has answers here:
Selenium test scripts to login into google account through new ajax login form
(1 answer)
Gmail login using selenium webdriver in java
(1 answer)
Closed 2 years ago.
I am using Chrome Browser version 79.0.3945.79 with Chrome Driver : ChromeDriver 79.0.3945.36
below is the code that i am using.
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Driver\\chromedriver.exe");
ChromeOptions options = new ChromeOptions();
options.addArguments("headless");
options.addArguments("window-size=1200x600");
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new ChromeDriver(options);
driver.manage().window().maximize(); // maximize window
driver.manage().deleteAllCookies(); // delete all the cookies
driver.manage().timeouts().pageLoadTimeout(40, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.get("http://www.google.com");
driver.findElement(By.xpath("//input[#name='q']")).sendKeys("Java");
--- Error message - Trace is as below---
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//input[#name='q']"}
(Session info: headless chrome=79.0.3945.79)
(Driver info: chromedriver=79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614}),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.06 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
System info: host: 'W01B77WL', ip: '10.129.5.50', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_144'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{mobileEmulationEnabled=false, timeouts={implicit=0, pageLoad=300000, script=30000}, hasTouchScreen=false, platform=XP, acceptSslCerts=false, goog:chromeOptions={debuggerAddress=localhost:49314}, acceptInsecureCerts=false, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=ignore, applicationCacheEnabled=false, rotatable=false, networkConnectionEnabled=false, chrome={chromedriverVersion=79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945#{#614}), userDataDir=C:\Users\t523760\AppData\Local\Temp\scoped_dir15468_643969098}, takesHeapSnapshot=true, pageLoadStrategy=normal, strictFileInteractability=false, databaseEnabled=false, handlesAlerts=true, version=79.0.3945.79, browserConnectionEnabled=false, proxy={}, nativeEvents=true, locationContextEnabled=true, cssSelectorsEnabled=true}]
Session ID: 9a85826c6fce9b59cbc489ecde141746
*** Element info: {Using=xpath, value=//input[#name='q']}
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:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:363)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:500)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:355)
at com.ubs.aem.test.UnitTest.testExecution(UnitTest.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)

Unable to run selenium with IE browser via Jenkins

Selenium version 3.5
IEDriverserver - 3.5.0
IE version - 11
Jenkins version 2.75
private static final WebDriver WebDriverRefrence = null;{
}
public WebDriver driver ;
#BeforeTest
public void launchBrowser() {
Logger.getRootLogger().setLevel(Level.OFF);
System.setProperty("webdriver.ie.driver","C:\\AUTOMATION\\IEDriverServer.exe");
//Turn ON Protected Mode for the IE Browser
DesiredCapabilities aots = DesiredCapabilities.internetExplorer();
aots.setCapability("nativeEvents",false);
aots.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,true);
driver = new InternetExplorerDriver(aots)
driver.get("https://www.gmail.com");
}
#Test
public void Test_case_001() throws InterruptedException {
driver.findElement(By.id("identifierId")).sendKeys("abc");
Thread.sleep(1000);
driver.findElement(By.xpath(".//*[#id='identifierNext']/div[2]")).click();
Thread.sleep(3000);
driver.findElement(By.xpath(".//*[#id='password']/div[1]/div/div[1]/input")).sendKeys("XXXXXX");
Thread.sleep(2000);
driver.findElement(By.xpath(".//*[#id='passwordNext']/div[2]")).click();
}
}
I have a simple Selenium code to login to Gmail.
I'm able to run successfully from eclipse (IE browser)
I'm able to run successfully from eclipse (FF browser)
I'm able to run successfully via Jenkins (FF browser)
But when I use IE browser and run via Jenkins, it fails.
The code and error is below. Don't know why element is not found when running via Jenkins.
Here is the error from testing output file :
-<test-method finished-at="2017-09-06T13:47:33Z" started-at="2017-09-06T13:47:26Z" duration-ms="6405" name="Test_case_001" signature="Test_case_001()[pri:0, instance:test2.practice#4c75cab9]" status="FAIL">
-<exception class="org.openqa.selenium.NoSuchElementException">
-<message>
-<![CDATA[Unable to find element with xpath == .//*[#id='password']/div[1]/div/div[1]/input
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: 'DESKTOP-E0D9KLG', ip: '135.70.196.248', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0.0, ie.ensureCleanSession=false, elementScrollBehavior=0.0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:43511/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000.0, ignoreProtectedModeSettings=true}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, javascriptEnabled=true, platformName=windows, setWindowRect=true, platform=ANY}]
Session ID: 1baa5458-8f37-4e13-9119-08b88aba17f0
*** Element info: {Using=xpath, value=.//*[#id='password']/div[1]/div/div[1]/input}]]>
</message>
-<full-stacktrace>
-<![CDATA[org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == .//*[#id='password']/div[1]/div/div[1]/input
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: 'DESKTOP-E0D9KLG', ip: '135.70.196.248', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_92'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{acceptInsecureCerts=false, browserVersion=11, se:ieOptions={nativeEvents=true, browserAttachTimeout=0.0, ie.ensureCleanSession=false, elementScrollBehavior=0.0, enablePersistentHover=true, ie.browserCommandLineSwitches=, ie.forceCreateProcessApi=false, requireWindowFocus=false, initialBrowserUrl=http://localhost:43511/, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000.0, ignoreProtectedModeSettings=true}, browserName=internet explorer, pageLoadStrategy=normal, unhandledPromptBehavior=dismiss, javascriptEnabled=true, platformName=windows, setWindowRect=true, platform=ANY}]
Session ID: 1baa5458-8f37-4e13-9119-08b88aba17f0
*** Element info: {Using=xpath, value=.//*[#id='password']/div[1]/div/div[1]/input}
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.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:185)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:120)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
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:641)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:414)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:513)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:406)
at test2.practice.Test_case_001(practice.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.TestNG.privateMain(TestNG.java:1355)
at org.testng.TestNG.main(TestNG.java:1324)

Selenium locator xpath not working for particular button

I'm looking for a working locator to address a button on a web page.
"Inspecting element" in the code I see :
<input class="ruButton ruBrowse" tabindex="-1" value="Select & Upload File" style="border: 0px dotted;" type="button">
Copying outerhtml I have :
<input tabindex="-1" value="Select & Upload File" class="ruButton ruBrowse" style="border: 0px dotted;" type="button">
I tried the following as xpath locators but these are not OK - I'd like to understand why :
//input[#value='Select & Upload File']
//input[#value='Select & Upload File']
This locator is OK :
driver.findElement(By.xpath("//input[contains(#class,'ruButton ruBrowse') and contains(#type,'button')]")).click();
More details on error log :
1)
driver.get(baseUrl);
driver.findElement(By.xpath("//input[contains(#value,'Select') and contains (#value,'Upload File')]")).click();
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //input[contains(#value,'Select') and contains(#value,'Upload File')] (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 297 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'BGC-W7X64T-2082', ip: '10.119.137.75', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:2351/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: 4613c6bf-239c-4ccb-b3b3-f1946276e7c7
*** Element info: {Using=xpath, value=//input[contains(#value,'Select') and contains(#value,'Upload File')]}
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.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.findElementByXPath(RemoteWebDriver.java:473)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:360)
at Selenium_And_AutoIt.main(Selenium_And_AutoIt.java:61)
2)
driver.get(baseUrl);
driver.findElement(By.xpath("//input[#value='Select & Upload File']")).click();
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //input[#value='Select & Upload File'] (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 281 milliseconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: '1969d75', time: '2016-10-18 09:43:45 -0700'
System info: host: 'BGC-W7X64T-2082', ip: '10.119.137.75', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_112'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{browserAttachTimeout=0, ie.enableFullPageScreenshot=true, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.forceShellWindowsApi=false, pageLoadStrategy=normal, ignoreZoomSetting=false, ie.fileUploadDialogTimeout=3000, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:21427/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: eb3f9de0-2fc1-41ce-8f15-6947f956c216
*** Element info: {Using=xpath, value=//input[#value='Select & Upload File']}
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.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.findElementByXPath(RemoteWebDriver.java:473)
at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:360)
at Selenium_And_AutoIt.main(Selenium_And_AutoIt.java:60)
Thank you !
For what it's worth, I've had trouble in the past with using text that has ampersand(s) inside as well. My solution is to use contains instead of "=" and only provide part of the value text, however, this might not be sufficient since there could conceivably be some other element that contains "Upload File" for example. My solution in this case, assuming that the locator as-is is incorrect, would be the following locator:
//input[contains(#value,'Select') and contains(#value,'Upload File')]
it could also substitute the 'contains' with 'starts-with' and 'ends-with' correspondingly.

alert not getting detected in selenium 3.0.0-beta2

i am using selenium 3.0.0-beta2 , my alert is not getting detected with below code.
Alert alert = driver.switchTo().alert();
String Actual = alert.getText();
below is the stack trace
org.openqa.selenium.UnhandledAlertException: unexpected alert open: {Alert text : Company Already Exists}
(Session info: chrome=52.0.2743.116)
(Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 52 milliseconds: null
Build info: version: '2.48.2', revision: '41bccdd', time: '2015-10-09 19:55:52'
System info: host: 'tct4-PC', ip: '192.168.0.60', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_45'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, chrome={chromedriverVersion=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4), userDataDir=C:\Users\tct4\AppData\Local\Temp\scoped_dir460432_24766}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=52.0.2743.116, platform=XP, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 6f2f063385fd93923cab757a17e7364a
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:422)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:164)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:647)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:670)
at org.openqa.selenium.remote.RemoteWebDriver.getScreenshotAs(RemoteWebDriver.java:325)
at com.tfleet.utilities.TakeScreenshot.takeScreenshot(TakeScreenshot.java:19)
at regression.Master.AddCompanyTest.addCompanyTest(AddCompanyTest.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:84)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
at org.testng.TestNG.run(TestNG.java:1057)
at org.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:74)
at org.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Info is not complete which browser you are using. If you are using with ChromeDriver then update your chrome browser and Download latest version of chromedriver from this link http://chromedriver.storage.googleapis.com/index.html. and use wait command then use it will work.
If u are using firefox then let me know.
Use this to handle the alert:
driver.switchTo().alert().accept();

Selenium Webdriver - IEDriver - Stuck at "This is the initial start page for the WebDriver server."

I am working on Webdriver to automate my testcase for Internet explorer 10. It was working fine until this morning, it can no longer get pass "This is the initial start page for the WebDriver server."
I am running IEDriverServer version 2.35.0 on IE10, enabled protected mode and zoom size 100%
Tried with firefox and it worked
Do any one of you have any idea what is wrong? it was fine last week and i came in this morning the IEdriver decide to die on me.
Basically it bypassed my driver.get and when straight to my action script and since its stuck at the "This is the initial start page for the WebDriver server." page, it cant really find that element. my exception,
org.openqa.selenium.ElementNotVisibleException: Element is not displayed (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 67 milliseconds
Build info: version: '2.35.0', revision: 'c916b9d', time: '2013-08-12 15:42:01'
System info: os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.6.0_35'
Session ID: f57d0009-b2e8-412a-aee8-0b22be041e88
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Capabilities [{platform=WINDOWS, javascriptEnabled=true, elementScrollBehavior=0, enablePersistentHover=true, ignoreZoomSetting=false, ie.ensureCleanSession=false, browserName=internet explorer, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss, version=10, ie.usePerProcessProxy=false, cssSelectorsEnabled=true, ignoreProtectedModeSettings=false, requireWindowFocus=false, [initialBrowserUrl=http://myhost:13703/], handlesAlerts=true, ie.forceCreateProcessApi=false, nativeEvents=true, browserAttachTimeout=0, ie.browserCommandLineSwitches=, takesScreenshot=true}]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:191)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:145)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:554)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:268)
at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:89)
at tcm_smoke.ViewFacilityRiskReport.testFacilityRiskReport(ViewFacilityRiskReport.java:69)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)