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

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.

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

How do I run a beam class in dataflow which access google sql instance?

When i run my pipeline from local machine, i can update the table which resides in the cloud Sql instance. But, when i moved this to run using DataflowRunner, the same is failing with the below exception.
To connect from my eclipse, I created the data source config as
.create("com.mysql.jdbc.Driver", "jdbc:mysql://<ip of sql instance > :3306/mydb") .
The same i changed to
.create("com.mysql.jdbc.GoogleDriver", "jdbc:google:mysql://<project-id>:<instance-name>/my-db") while running through the Dataflow runner.
Should i prefix the zone information of the instance to ?
The exception i get when i run this is given below :
Jun 22, 2017 6:53:58 PM org.apache.beam.runners.dataflow.util.MonitoringUtil$LoggingHandler process
INFO: 2017-06-22T13:23:51.583Z: (840be37ab35d3d0d): Starting 2 workers in us-central1-f...
Jun 22, 2017 6:53:58 PM org.apache.beam.runners.dataflow.util.MonitoringUtil$LoggingHandler process
INFO: 2017-06-22T13:23:51.634Z: (dabfae1dc9365d10): Executing operation JdbcIO.Read/Create.Values/Read(CreateSource)+JdbcIO.Read/ParDo(Read)+JdbcIO.Read/ParDo(Anonymous)+JdbcIO.Read/GroupByKey/Reify+JdbcIO.Read/GroupByKey/Write
Jun 22, 2017 6:54:49 PM org.apache.beam.runners.dataflow.util.MonitoringUtil$LoggingHandler process
INFO: 2017-06-22T13:24:44.762Z: (21395b94f8bf7f61): Workers have started successfully.
SEVERE: 2017-06-22T13:25:30.214Z: (3b988386f963503e): java.lang.RuntimeException: org.apache.beam.sdk.util.UserCodeException: java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.jdbc.GoogleDriver'
at com.google.cloud.dataflow.worker.runners.worker.MapTaskExecutorFactory$3.typedApply(MapTaskExecutorFactory.java:289)
at com.google.cloud.dataflow.worker.runners.worker.MapTaskExecutorFactory$3.typedApply(MapTaskExecutorFactory.java:261)
at com.google.cloud.dataflow.worker.graph.Networks$TypeSafeNodeFunction.apply(Networks.java:55)
at com.google.cloud.dataflow.worker.graph.Networks$TypeSafeNodeFunction.apply(Networks.java:43)
at com.google.cloud.dataflow.worker.graph.Networks.replaceDirectedNetworkNodes(Networks.java:78)
at com.google.cloud.dataflow.worker.runners.worker.MapTaskExecutorFactory.create(MapTaskExecutorFactory.java:152)
at com.google.cloud.dataflow.worker.runners.worker.DataflowWorker.doWork(DataflowWorker.java:272)
at com.google.cloud.dataflow.worker.runners.worker.DataflowWorker.getAndPerformWork(DataflowWorker.java:244)
at com.google.cloud.dataflow.worker.runners.worker.DataflowBatchWorkerHarness$WorkerThread.doWork(DataflowBatchWorkerHarness.java:125)
at com.google.cloud.dataflow.worker.runners.worker.DataflowBatchWorkerHarness$WorkerThread.call(DataflowBatchWorkerHarness.java:105)
at com.google.cloud.dataflow.worker.runners.worker.DataflowBatchWorkerHarness$WorkerThread.call(DataflowBatchWorkerHarness.java:92)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.apache.beam.sdk.util.UserCodeException: java.sql.SQLException: Cannot load JDBC driver class 'com.mysql.jdbc.GoogleDriver'
at org.apache.beam.sdk.util.UserCodeException.wrap(UserCodeException.java:36)
at org.apache.beam.sdk.io.jdbc.JdbcIO$Read$ReadFn$auxiliary$M7MKjX9p.invokeSetup(Unknown Source)
at com.google.cloud.dataflow.worker.runners.worker.DoFnInstanceManagers$ConcurrentQueueInstanceManager.deserializeCopy(DoFnInstanceManagers.java:65)
at com.google.cloud.dataflow.worker.runners.worker.DoFnInstanceManagers$ConcurrentQueueInstanceManager.peek(DoFnInstanceManagers.java:47)
at com.google.cloud.dataflow.worker.runners.worker.UserParDoFnFactory.create(UserParDoFnFactory.java:100)
at com.google.cloud.dataflow.worker.runners.worker.DefaultParDoFnFactory.create(DefaultParDoFnFactory.java:70)
at com.google.cloud.dataflow.worker.runners.worker.MapTaskExecutorFactory.createParDoOperation(MapTaskExecutorFactory.java:365)
at com.google.cloud.dataflow.worker.runners.worker.MapTaskExecutorFactory$3.typedApply(MapTaskExecutorFactory.java:278)
... 14 more
Any help to fix this is really appreciated. This is my first attempt to run a beam pipeline as a dataflow job.
PipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
((DataflowPipelineOptions) options).setNumWorkers(2);
((DataflowPipelineOptions)options).setProject("xxxxx");
((DataflowPipelineOptions)options).setStagingLocation("gs://xxxx/staging");
((DataflowPipelineOptions)options).setRunner(DataflowRunner.class);
((DataflowPipelineOptions)options).setStreaming(false);
options.setTempLocation("gs://xxxx/tempbucket");
options.setJobName("sqlpipeline");
PCollection<Account> collection = dataflowPipeline.apply(JdbcIO.<Account>read()
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration
.create("com.mysql.jdbc.GoogleDriver", "jdbc:google:mysql://project-id:testdb/db")
.withUsername("root").withPassword("root"))
.withQuery(
"select account_id,account_parent,account_description,account_type,account_rollup,Custom_Members from account")
.withCoder(AvroCoder.of(Account.class)).withStatementPreparator(new JdbcIO.StatementPreparator() {
public void setParameters(PreparedStatement preparedStatement) throws Exception {
preparedStatement.setFetchSize(1);
preparedStatement.setFetchDirection(ResultSet.FETCH_FORWARD);
}
}).withRowMapper(new JdbcIO.RowMapper<Account>() {
public Account mapRow(ResultSet resultSet) throws Exception {
Account account = new Account();
account.setAccount_id(resultSet.getInt("account_id"));
account.setAccount_parent(resultSet.getInt("account_parent"));
account.setAccount_description(resultSet.getString("account_description"));
account.setAccount_type(resultSet.getString("account_type"));
account.setAccount_rollup("account_rollup");
account.setCustom_Members("Custom_Members");
return account;
}
}));
Have you properly pulled in the com.google.cloud.sql/mysql-socket-factory maven dependency? Looks like you are failing to load the class.
https://cloud.google.com/appengine/docs/standard/java/cloud-sql/#Java_Connect_to_your_database
Hi I think it's better to move on with "com.mysql.jdbc.Driver" because google driver is supporting for app engine deployments
So as it goes this is what my pipeline configurations look alike and it works perfectly fine for me
PCollection < KV < Double, Double >> exchangeRates = p.apply(JdbcIO. < KV < Double, Double >> read()
.withDataSourceConfiguration(JdbcIO.DataSourceConfiguration.create("com.mysql.jdbc.Driver", "jdbc:mysql://ip:3306/dbname?user=root&password=root&useUnicode=true&characterEncoding=UTF-8")
)
.withQuery(
"SELECT PERIOD_YEAR, PERIOD_YEAR FROM SALE")
.withCoder(KvCoder.of(DoubleCoder.of(), DoubleCoder.of()))
.withRowMapper(new JdbcIO.RowMapper < KV < Double, Double >> () {
#Override
public KV<Double, Double> mapRow(java.sql.ResultSet resultSet) throws Exception {
LOG.info(resultSet.getDouble(1)+ "Came");
return KV.of(resultSet.getDouble(1), resultSet.getDouble(2));
}
}));
Hope it will help

Using scala-js-env-selenium for crossbrowser testing

I am using https://github.com/scala-js/scala-js-env-selenium for in-browser testing, so far tests are running fine in local browser. Now i want to run my tests in remote browsers (https://app.crossbrowsertesting.com)
I created new CrossBrowser
import org.openqa.selenium.remote.{DesiredCapabilities, RemoteWebDriver}
import org.scalajs.jsenv.selenium.{BrowserDriver, SeleniumBrowser}
import java.net.URL
object CrossBrowser {
def apply(): CrossBrowser = new CrossBrowser
val username = "email"
// Your username
val authkey = "xxxxxxxxxx" // Your authkey
}
class CrossBrowser private() extends SeleniumBrowser {
def name: String = "RemoteBrowser"
def newDriver: BrowserDriver = new CrossDriver
private class CrossDriver extends BrowserDriver {
protected def newDriver(): RemoteWebDriver = {
val caps = new DesiredCapabilities()
caps.setCapability("name", "Selenium Test Example")
caps.setCapability("build", "1.0")
caps.setCapability("browser_api_name", "IE10")
caps.setCapability("os_api_name", "Win7x64-C2")
caps.setCapability("screen_resolution", "1024x768")
caps.setCapability("record_video", "true")
caps.setCapability("record_network", "true")
new RemoteWebDriver(new URL("http://" + CrossBrowser.username + ":" + CrossBrowser.authkey + "#hub.crossbrowsertesting.com:80/wd/hub"), caps)
}
}
}
and updated build settings
jsEnv := new org.scalajs.jsenv.selenium.SeleniumJSEnv(CrossBrowser()),
jsEnv in Test := new org.scalajs.jsenv.selenium.SeleniumJSEnv(CrossBrowser())
when i ran test command i got following output
[trace] Stack trace suppressed: run last client/test:loadedTestFrameworks for the full output.
[error] (client/test:loadedTestFrameworks) org.openqa.selenium.WebDriverException: [fc92901a-f56a-4e4b-9d75-953402cbfe35] Test has timed out after 199 seconds
[error] Command duration or timeout: 199.20 seconds
[error] Build info: version: '2.53.0', revision: '35ae25b1534ae328c771e0856c93e187490ca824', time: '2016-03-15 10:43:46'
[error] System info: host: 'Chandras-MacBook-Pro.local', ip: 'xx.xx.xxx.x', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.3', java.version: '1.8.0_25'
[error] Driver info: org.openqa.selenium.remote.RemoteWebDriver
[error] Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, pageLoadStrategy=normal, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=10, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, webdriver.remote.sessionid=fc92901a-f56a-4e4b-9d75-953402cbfe35, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:33793/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}]
[error] Session ID: fc92901a-f56a-4e4b-9d75-953402cbfe35
Reason for time out is , test-runner tried to load file:/var/folders/n0/c0fyqlqx0gg15mv4t5mchgj80000gn/T/1464125278337-0/scalajsRun.html on remote machine which doesn't exist.
is it possible to do this kind of testing ..?(copy files to some server and load that url ..)
Selenium will need access to your files if you are running local tests. That's usually done via proxies. There seems to be support for local testing though (https://crossbrowsertesting.com/local-testing), you could try to contact them to set this up.

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