Can 2 seperate test access the page factory at once? - selenium

I recently switched to the pagefactory model and i noticed when running test in parallel will fail all of the time(It used to work fine before switching over to the page factory model). i have code sample if anyone want to look at it. I am using Selenium webdriver with testng right now. The first test returns the following
org.openqa.selenium.WebDriverException: Build info: version: '2.43.0', revision: '597b76b', time: '2014-09-09 20:52:38'
the rest of the test return the following
org.openqa.selenium.remote.SessionNotFoundException: Session ID is null. Using WebDriver after calling quit()?
also when i run the tests one by one they run normal.

Related

While running multiple automated tests in BrowserStack, first test runs successfully but the sessions doesn't get created for remaining ones

I am running multiple automated tests (Cucumber, Selenium) in BrowserStack. For the first test, the scenario gets executed. However, from the second test onward, no session gets created in BrowserStack and the scenarios fail with the below exception:
org.openqa.selenium.WebDriverException: [browserstack.local] is set to true but local testing through BrowserStack is not connected. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 5.13 seconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
As mentioned, this occurs only from the second automated test onward while executing multiple tests; if each of the test is run individually, the problem does not arise.
Looks to be an issue with your test execution method. After the first test, the local tunnel connection appears to be destroyed.
The second test does not have an active tunnel and leads to the error message.
I'd recommend tearing down the tunnel once all the sessions complete execution.

Not able to run selenium test cases in jenkins

1)I have created a job in Jenkins to run selenium tests cases which consists of 5 feature files
2)I am using "Execute Shell" of Jenkins to run the test cases
where I have fired the command by going to that particular folder and running command gradle test
eg. >cd ABC
>gradle test
when I run this job by using "build Now" the test cases fails showing error
1)java.lang.IllegalStateException: Failed to load ApplicationContext
2)Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.openqa.selenium.WebDriver]: Factory method 'getWebDriver' threw exception; nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.cosmicapp.webbrowser.FirefoxWebDriver
3)caused by java.lang.NoClassDefFoundError: Could not initialize class com.cosmicapp.webbrowser.FirefoxWebDriver
And when I run the above test cases on my machine it runs fine.
It seems there is a problem in the Jenkins project workspace or Jenkins is not able to invoke firefox or chrome browser.

Webdriver gives Timeout Exception running Codeception acceptance test

I have a long pipeline of Codeception acceptance test set up in Jenkins. Safari regularly throws an \ScriptTimeoutException when starting a test (every 14 - 23 browser start throws this error). This does not happen on the same test each time the pipeline is started.
The exception prints as:
[Facebook\Webdriver\Exception\ScriptTimeoutException]
Timed out awaiting response to command "maximizeWindow" after 30002 ms
(WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.01 seconds
Currently, the safari environmental variable in acceptance.suite.yml looks like this:
safari:
modules:
config:
WebDriver:
browser: 'safari'
window_size: 'maximize'
clear_cookies: true
restart: true
options:
cleanSession: true
I've tried setting an exact window size and removing the window_size option entirely. There did not appear to be any difference in the occurrence rate of this error.
Using Selenium server 2.53.1. Safari version 9.1.2. Jenkins version 2.16
Any ideas on who to reduce the number of times this is happening?
I have also got this error:
1) ListingRaceTestCest: Test events
Test tests/acceptance/ListingRaceTestCest.php:Login
[Facebook\WebDriver\Exception\TimeOutException]
Scenario Steps:
$I->waitForElementVisible(".rule-row-date",15)
$I->click("button#add-rule-btn")
$I->see("Configure payment rules")
$I->waitForElementVisible("#side-menu",15)
$I->pauseExecution()
$I->click("table#races-table tbody tr:first-child td:last-child button")
I have found a solution now and its working for me, try this hope it works for you!
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
This is setting for dynamic time you can change it accordingly. Codeception provides the execution time facility approx 5 min then it will give timeout error.
This situation I got and now found the solution.

Error while running protractor-perf tests

I have setup protractor-perf tests following the post by Parshuram.
However, when I run the tests using protractor-perf command, I get the following error:
Driver info: driver.version: unknown[0m
Stacktrace:
Error: [execute("(function(){var getTimeMs=(function(){if(window.performance)\nreturn(performance.now||performance.mozNow||performance.msNow||performance.oNow||performance.webkitNow).bind(window.performance);else\nreturn function(){return new Date().getTime();};})();var requestAnimationFrame=(function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(callback){window.setTimeout(callback,1000/60);};})().bind(window);window.__RafRecorder={frames:[],flush:true,record:function(timeStamp){if(__RafRecorder.flush){__RafRecorder.frames=[];__RafRecorder.flush=false;}\n__RafRecorder.frames.push(timeStamp);requestAnimationFrame(__RafRecorder.record);},get:function(){__RafRecorder.flush=true;return __RafRecorder.frames;}};requestAnimationFrame(window.__RafRecorder.record);}());")] Error response status: 13, , UnknownError - An unknown server-side error occurred while processing the command. Selenium error: Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
Info: Tests are run on chrome driver.
Please see if someone can help! Please let me know if more information is required.
PS: If I run the same test with protractor conf.js command, everything works fine. So, seemingly there is some issue with the protractor-perf setup OR I am missing some step somewhere!
The issue is resolved by starting the selenium webdriver. Earlier my tests were using Chromedriver directly and thus the issue.

No such field error given by selenium web driver

I am trying to execute tests on selenium grid.I am getting no such field error when the RemoteDriver.driver.navigate().to(Link); is executed