sendKeys(protractor.Key.TAB) and (protractor.Key.RETURN) is thorwing an error - protractor

I am using keyboard keys to fill forms and using the Tab and Enter keys it throwing me an error while running in the script.
Failed: sendKeysToActiveElement
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'BBUNTY', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_212-release'
Driver info: driver.version: unknown
UnsupportedOperationError: sendKeysToActiveElement
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'BBUNTY', ip: '192.168.56.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_212-release'
Driver info: driver.version: unknown
Below is the code I have used in the script
browser.actions().sendKeys(protractor.Key.TAB).perform();
page.getUsercountrycodeinput().click().then( function(){
page.getUsercountrycodeinput().element(by.className('ng-input'))
.element(by.cssContainingText('ng-dropdown-panel ng-select-top', '+91'));
browser.actions().sendKeys(protractor.Key.RETURN).perform();
});
it is a dropdown input field I am searching for text and then selecting the value '+91' form the dropdown field.
Chrome Version is 90.0.4430.212
webdriver version is chromedriver_90.0.4430.212.

Try disabling w3c in your config file under capabilities.
capabilities: {
'browserName': 'chrome',
'chromeOptions': {
w3c: false
}
}
More details here - https://github.com/angular/protractor/issues/5285

Related

Need to click on Contacts tab in Salesforce getting error "Cannot read properties of undefined (reading 'defaultView')"

Through automated script wants to click on Contacts tab in Salesforce. But unable to do so.
Getting error:
org.openqa.selenium.JavascriptException: javascript error: Cannot read properties of undefined (reading 'defaultView')
(Session info: chrome=94.0.4606.81)
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: '****-****', ip: '***.***.*.*', 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: 94.0.4606.81, chrome: {chromedriverVersion: 93.0.4577.63 (ff5c0da2ec0ad..., userDataDir: C:\Users\Sristi\AppData\Loc...}, goog:chromeOptions: {debuggerAddress: localhost:59263}, 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:extension:credBlob: true, webauthn:extension:largeBlob: true, webauthn:virtualAuthenticators: true}
Session ID: 0a464ae7e61949632bc4c84b5e790525
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)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:187)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:122)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:49)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:285)
at org.openqa.selenium.remote.RemoteWebElement.click(RemoteWebElement.java:84)
at Automation.CreateTPARequest.loginTPAPortal(CreateTPARequest.java:60)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:133)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:598)
at org.testng.internal.TestInvoker.invokeTestMethod(TestInvoker.java:173)
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:824)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.testng.TestRunner.privateRun(TestRunner.java:794)
at org.testng.TestRunner.run(TestRunner.java:596)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:377)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:371)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:332)
at org.testng.SuiteRunner.run(SuiteRunner.java:276)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:96)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1212)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1134)
at org.testng.TestNG.runSuites(TestNG.java:1063)
at org.testng.TestNG.run(TestNG.java:1031)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:115)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
I have tried below 3 scenarios, but none worked. This code was working till yesterday noon after evening getting above mentioned error :
1.
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
WebElement contacts=driver.findElement(By.xpath("//div[#class='slds-context-bar']/one-app-nav-bar[#class='slds-grid slds-has-flexi-truncate']/nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[1]/a[#title='Contacts']/span[#class='slds-truncate' and text()='Contacts']"));
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
contacts.click();
//new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[2]/a[#title='Contacts']"))).click();
//driver.findElement(By.xpath("//nav[#class='slds-context-bar__secondary navCenter']/div/one-app-nav-bar-item-root[2]/a[#title='Contacts']")).click();
There are 4 ways to click in Selenium.
I will use this xpath
//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]
Code trial 1 :
Thread.sleep(5);
driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]")).click();
Code trial 2 :
new WebDriverWait(driver, 20).until(ExpectedConditions.elementToBeClickable(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"))).click();
Code trial 3 :
Thread.sleep(5);
WebElement button = driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"));
((JavascriptExecutor)driver).executeScript("arguments[0].click();", button);
Code trial 4 :
Thread.sleep(5);
WebElement button = driver.findElement(By.xpath("//span[text()='Contacts']/parent::a[contains(#href,'lightning/o/Contact/home')]"));
new Actions(driver).moveToElement(button).click().build().perform();
PS : Please check in the dev tools (Google chrome) if we have unique entry in HTML DOM or not.
Steps to check:
Press F12 in Chrome -> go to element section -> do a CTRL + F -> then paste the xpath and see, if your desired element is getting highlighted with 1/1 matching node.

protractor tutorial step throwing "element not visible"

I'm new to protractor and am going through the tutorial. The setup and Step 0 worked fine for me but I had an unexpected error in Step 1:
$ protractor conf.js
[13:11:41] I/launcher - Running 1 instances of WebDriver
[13:11:41] I/hosted - Using the selenium server at http://localhost:4444/wd/hub
Started
seeking `first`
seeking `second`
seeking `gobutton`
seeking `latest`
F
Failures:
1) Protractor Demo App should add one and two
Message:
Failed: element not visible
(Session info: chrome=60.0.3112.78)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-87-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 43 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'pfuntner1', ip: '9.42.83.35', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-87-generic', java.version: '1.8.0'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8), userDataDir=/tmp/.org.chromium.Chromium.ZhadTr}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.78, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
Session ID: cf611f619dbf2069413885ed9bcbba17
Stack:
ElementNotVisibleError: element not visible
(Session info: chrome=60.0.3112.78)
(Driver info: chromedriver=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8),platform=Linux 4.4.0-87-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 43 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'pfuntner1', ip: '9.42.83.35', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-87-generic', java.version: '1.8.0'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.31.488763 (092de99f48a300323ecf8c2a4e2e7cab51de5ba8), userDataDir=/tmp/.org.chromium.Chromium.ZhadTr}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=60.0.3112.78, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, setWindowRect=true, unexpectedAlertBehaviour=}]
.
.
.
I added debugging statements to spec.js to try to identify what element it can't find. It appears to find the two input fields and the button fine but does not find the output field.
Here is my spec.js:
// spec.js
describe('Protractor Demo App', function() {
it('should add one and two', function() {
browser.get('http://juliemr.github.io/protractor-demo/');
console.log("seeking `first`");
element(by.model('first')).sendKeys(1);
console.log("seeking `second`");
element(by.model('second')).sendKeys(2);
console.log("seeking `gobutton`");
element(by.id('gobutton')).click();
console.log("seeking `latest`");
expect(element(by.binding('latest')).getText()).toEqual('5'); // This is wrong!
});
});
Am I doing something wrong?
Now there are few possible things happening here
The element that is returned by element(by.binding('latest')) is not the correct one
There are multiple elements matching element(by.binding('latest')) and the first one is being returned to you
The element being returned to you is not visible on the screen. Chromedriver is very specific when it comes to taking actions on element which are visible to the user. If the element is not visible to user a automation shouldn't be able to simulate action on it (not 100% true, because some actions can still be taken).
So make sure you are getting the right element and there are no multiple matches

Not able to run Protractor tests (5.0.0) on IE11

Protractor : 5.0.0, IE11, IEDriverServer_Win32_3.0.0.exe
conf file:
capabilities: {
browserName: 'internet explorer',
}
localSeleniumStandaloneOpts: {
jvmArgs: ["-Dwebdriver.ie.driver=.\\node_modules\\protractor\\node_modules\\webdriver-manager\\selenium\\IEDriverServer.exe"]
}
IE browsers opens up but doesn't do anything. Following is the error
[11:12:22] I/local - Starting selenium standalone server...
[11:12:22] I/launcher - Running 1 instances of WebDriver
[11:12:23] I/local - Selenium standalone server started at http://192.168.56.1:53122/wd/hub
Started
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
F[11:12:26] E/launcher - Unable to get browser (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'RLAPTOP', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
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:36498/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: e830e362-bb50-41bb-8b2d-cd4bd35f6d4d
[11:12:26] E/launcher - NoSuchWindowError: Unable to get browser (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 15 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:48:19 -0700'
System info: host: 'RLAPTOP', ip: '', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_111'
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:36498/, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, unexpectedAlertBehaviour=dismiss}]
Session ID: e830e362-bb50-41bb-8b2d-cd4bd35f6d4d
at WebDriverError (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\error.js:27:5)
at NoSuchWindowError (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\error.js:192:5)
at Object.checkLegacyResponse (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\error.js:505:15)
at parseHttpResponse (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\http.js:509:13)
at doSend.then.response (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\http.js:440:13)
at process._tickCallback (internal/process/next_tick.js:103:7)
From: Task: WebDriver.getCurrentUrl()
at WebDriver.schedule (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\webdriver.js:816:17)
at WebDriver.getCurrentUrl (C:\QA\testingmaster\tests\protractor_tests\node_modules\selenium-webdriver\lib\webdriver.js:1002:17)
at ScreenshotReporter.specDone (C:\QA\testingmaster\tests\protractor_tests\e2e\jasmine_reporters\screenshot_reporter.js:12:22)
at dispatch (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1966:28)
at ReportDispatcher.specDone (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1949:11)
at Spec.specResultCallback [as resultCallback] (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:903:18)
at complete (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:368:12)
at QueueRunner.clearStack (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:660:9)
at QueueRunner.run (C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1881:12)
at C:\QA\testingmaster\tests\protractor_tests\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:1898:16
[11:12:26] E/launcher - Process exited with error code 199
Any suggestions? Do i need to start selenium server as well manually ?

Selenium script doesnot wait long enough for the time defined in explicit wait

I am writing a selenium script using TestNG framework. i have defined the explicit wait as 20 seconds before selenium throws the NoSuchElement exception. but script does not wait for the 20 second during the execution and throws exception in 41 milliseconds.
i want this script to wait(using explicit wait only) or search for web element for 20 seconds before throwing any exception.
Below is the script followed by the execution result.
public class para {
WebDriver driver;
#BeforeClass
void InvokeFF() {
System.setProperty("webdriver.gecko.driver",
"C:/Users/Vinay/workspace_n/EGuru/drivers/geckodriver.exe");
driver = new FirefoxDriver();
// driver.get("http://seleniumpractise.blogspot.in/2016/08/bootstrap-dropdown-example-for-selenium.html");
System.out.println("Firefox invoked");
System.out.println("Firefox thread:" + Thread.currentThread().getId());
}
#Test
void Auto() throws Exception {
WebDriverWait wait = new WebDriverWait(driver, 20);
driver.get("file:///C:/Users/Vinay/Desktop/Upload1.html");
WebElement elem = driver.findElement(By.xpath(".//*[#id='1']"));
wait.until(ExpectedConditions.visibilityOfElementLocated(By
.xpath(".//*[#id='1']")));
elem.click();
Runtime.getRuntime().exec("C:\\Users\\Vinay\\Desktop\\AutoUpload.exe");
}
Firefox invoked Firefox thread:1 Execution Started [Utils] Attempting
to create C:\Users\Vinay\workspace_n\EGuru\test-output\Default
suite\Default test.xml [Utils] Directory
C:\Users\Vinay\workspace_n\EGuru\test-output\Default suite exists:
true FAILED: Auto org.openqa.selenium.NoSuchElementException: Unable
to locate element: {"method":"xpath","selector":".//*[#id='1']"}
Command duration or timeout: 41 milliseconds For documentation on this
error, please visit:
http://seleniumhq.org/exceptions/no_such_element.html Build info:
version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
System info: host: 'Vinay-PC', ip: '192.168.1.2', os.name: 'Windows
7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.firefox.FirefoxDriver Capabilities
[{applicationCacheEnabled=true, rotatable=false, handlesAlerts=true,
databaseEnabled=true, version=45.0.2, platform=WINDOWS,
nativeEvents=false, acceptSslCerts=true, webStorageEnabled=true,
locationContextEnabled=true, browserName=firefox,
takesScreenshot=true, javascriptEnabled=true,
cssSelectorsEnabled=true}] Session ID:
d40fc001-400c-473b-8213-078e641b3c7f
*** Element info: {Using=xpath, value=.//*[#id='1']} at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
WebElement elem = driver.findElement(By.xpath(".//*[#id='1']"));
wait.until(ExpectedConditions.visibilityOfElementLocated(By
.xpath(".//*[#id='1']")));
The above two lines need to be reversed in order. You are attempting to get the element without a wait, then telling the webdriver to wait until it's there.

Cannot get phantomjs to login to DEV paypal account -

I am attempting to login to the DEV PAYPAL site using phantomJS.
On clicking the login button from the popup I am seeing the following error message
Exception in thread "main" org.openqa.selenium.WebDriverException: Error Message => 'Click succeeded but Load Failed. Status: 'fail''
caused by Request => {"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:55458"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1371206664100\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/5e4434e0-d4df-11e2-941a-e76337e4cf88/element/%3Awdc%3A1371206664100/click"}
Command duration or timeout: 7.12 seconds
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_25-ea'
Session ID: 5e4434e0-d4df-11e2-941a-e76337e4cf88
Driver info: org.openqa.selenium.phantomjs.PhantomJSDriver
Capabilities [{platform=XP, acceptSslCerts=false, javascriptEnabled=true, browserName=phantomjs, rotatable=false, driverVersion=1.0.3, locationContextEnabled=false, version=1.9.0, databaseEnabled=false, cssSelectorsEnabled=true, handlesAlerts=false, browserConnectionEnabled=false, proxy={proxyType=direct}, webStorageEnabled=false, nativeEvents=true, driverName=ghostdriver, applicationCacheEnabled=false, takesScreenshot=true}]
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:187)
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.click(RemoteWebElement.java:79)
at com.selenium.wipro.Phantomsample.ExampleScenario.main(ExampleScenario.java:114)
Caused by: org.openqa.selenium.remote.ScreenshotException: Screen shot has been taken
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_25-ea'
Driver info: driver.version: RemoteWebDriver
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:125)
... 4 more
Caused by: org.openqa.selenium.remote.ErrorHandler$UnknownServerException: Error Message => 'Click succeeded but Load Failed. Status: 'fail''
caused by Request => {"headers":{"Accept":"application/json, image/png","Connection":"Keep-Alive","Content-Length":"27","Content-Type":"application/json; charset=utf-8","Host":"localhost:55458"},"httpVersion":"1.1","method":"POST","post":"{\"id\":\":wdc:1371206664100\"}","url":"/click","urlParsed":{"anchor":"","query":"","file":"click","directory":"/","path":"/click","relative":"/click","port":"","host":"","password":"","user":"","userInfo":"","authority":"","protocol":"","source":"/click","queryKey":{},"chunks":["click"]},"urlOriginal":"/session/5e4434e0-d4df-11e2-941a-e76337e4cf88/element/%3Awdc%3A1371206664100/click"}
Build info: version: '2.32.0', revision: '6c40c18', time: '2013-04-09 17:22:56'
System info: os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.6.0_25-ea'
Driver info: driver.version: unknown
I am using phantomjs 1.9.0 through the JAVA WebDriver.
I have done a lot of reading and have tried setting the following capability
DesiredCapabilities PJScapabilities = DesiredCapabilities.phantomjs();
PJScapabilities.setCapability("takesScreenshot", true);
PJScapabilities.setCapability("secureSsl", true);
PJScapabilities.setCapability("acceptSslCerts", true);
PJScapabilities.setCapability("javascriptEnabled", true );
//Need to set an environmental variable that points to the location of the PhantomJS Binary for GhostDriver support
//D:\workspace\phantomjs
PJScapabilities.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "D:\\workspace\\phantomjs\\phantomjs.exe");
This is a bug with GhostDriver. See:
https://github.com/detro/ghostdriver/issues/202