Unable to run Selenium tests on CentOS through Xvfb - selenium

I'm running Selenium tests on CentOS 7 machine through Jenkins pipeline hence using Xvfb. When use screen argument with any valid value like following -
wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x8']) {
<code to run Selenium test here>
}
It results into following error -
[testng] org.openqa.selenium.WebDriverException: chrome not reachable
[testng] (Session info: chrome=80.0.3987.132)
[testng] (Driver info: chromedriver=80.0.3987.16 (320f6526c1632ad4f205ebce69b99a062ed78647-refs/branch-heads/3987#{#185}),platform=Linux 3.10.0-862.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
[testng] Command duration or timeout: 0 milliseconds
[testng] Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:13:22.693Z'
If we run it without screen argument it runs successfully.
One more observation - with screen argument, it perfectly works on Ubuntu 18
Please help me how I can run Selenium tests with screen argument on CentOS 7.

After trying with different values for screen parameters, I realized this is not something which is wrong with Chrome browser or driver but with value passed to screen
When I changed depth value from 8 to 16, Selenium execution started successfully - screen: '1440x800x16'
wrap([$class: 'Xvfb', autoDisplayName: true, screen: '1440x800x16']) {
<code to run Selenium test here>
}
But technically, I did not understand why this error occurs and how depth value helped to resolve it.

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.

Regression test suit on Jenkins throws several error while same thing on my local is running fine

My team is using Jenkins for running test suits and getting report. Our regression test suit runs well on local machines while running the same test on Jenkins throws several errors, most of which, nearly 99%, is about selenium unable to locate element.
What would be cause of the issue?
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":"[data-testid='regular-shipment-form-step-shipment-scale-button-proceed']"}
(Session info: chrome=80.0.3987.106)
(Driver info: chromedriver=2.36.540471 (9c759b81a907e70363c6312294d30b6ccccc2752),platform=Linux 4.15.0-1077-azure x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 0 milliseconds

Cannot run automation tests against IE11 on Windows Server 2016 using Selenium and IEWebDriverServer 3.4.0

OS: Windows Server 2016 Datacenter (64 bit)
Browser: Internet Explorer 11.0.14393.0
Protractor: 5.1.2
Selenium server standalone: 3.4.0
IEWebDriverServer.exe: 3.4.0
Java: 1.8.0_131
We are attempting to run automation tests against Internet Explorer 11 on a Windows Server 2016 VM. The tests can be executed against Chrome on the VM via the Selenium server, but fail in IE.
When running against IE protractor is able to start the Selenium server which opens in IE. Another window is then launched with ‘about:blank’ in the address bar. This quickly closes, and the following error is display in the console window:
[13:57:18] I/launcher - Running 1 instances of WebDriver
[13:57:18] I/local - Starting selenium standalone server...
[13:57:19] I/local - Selenium standalone server started at http://10.X.X.X:61263/wd/hub
Started
A Jasmine spec timed out. Resetting the WebDriver Control Flow.
Failures:
1) angularjs homepage todo list should add a todo
Message:
Failed: JavaScript error (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 26 milliseconds
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'XXXX', ip: '10.X.X.X', os.name: 'Windows Server 2016', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_131'
Driver info: org.openqa.selenium.ie.InternetExplorerDriver
Further logging from the web driver has uncovered a number of [Access is denied.] issues:
D 2017-06-22 10:43:26:213 BrowserFactory.cpp(248) Starting IE using the IELaunchURL API
D 2017-06-22 10:43:26:360 BrowserFactory.cpp(202) IE launched successfully with process ID 4612
D 2017-06-22 10:43:26:360 BrowserFactory.cpp(208) Process with ID 4612 is executing iexplore.exe
D 2017-06-22 10:43:26:360 BrowserFactory.cpp(375) Using Active Accessibility to find IWebBrowser2 interface
D 2017-06-22 10:43:27:615 BrowserFactory.cpp(434) Found window handle 000A017A for window with class 'Internet Explorer_Server' belonging to process with id 4612
D 2017-06-22 10:43:27:636 BrowserFactory.cpp(396) Ignoring zoom setting: 0
W 2017-06-22 10:43:27:644 BrowserFactory.cpp(664) -2147024891 [Access is denied.]: Call to IHTMLWindow2::get_screen failed
…
I 2017-06-22 10:43:28:028 Browser.cpp(130) No child frame focus. Focus is on top-level frame
W 2017-06-22 10:43:28:040 Script.cpp(494) -2147024891 [Access is denied.]: Unable to execute code, call to IHTMLWindow2::execScript failed
W 2017-06-22 10:43:28:040 Script.cpp(180) Cannot create anonymous function
W 2017-06-22 10:43:28:040 response.cc(77) Error response has status code 17 and message 'JavaScript error' message
…
It seems obvious that there is a permissions issue in IE, but no amount of loosening of the browser security settings have had any impact.
What I have tried:
Set ‘Enable Protected Mode’ to disabled for all zones
Set ‘Allow Scripting of Microsoft web browser control’ to enabled
Tried a number of IEWebDriverServers including both 32 and 64 bit versions
Tried IE11 32 and 64bit
Added the 2 registry keys FEATURE_BFCACHE for both 32 and 64bit instances of IE (https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver)
Disabled ‘Enhanced Protected Mode’
The configuration mentioned in this article: http://elgalu.github.io/2014/run-protractor-against-internet-explorer-vm/
Has anyone had any success getting IEDriverServer running on Windows Server 2016? How can I get past these access denied issues?
Protractor configuration:
exports.config = {
capabilities: {
'browserName': 'internet explorer',
'platform': 'WINDOWS',
'version': '11'
},
seleniumServerJar: '<absolute path to /npm/node_modules/protractor/node_modules/webdriver-manager/selenium/selenium-server-standalone-3.4.0.jar>',
localSeleniumStandaloneOpts : {
jvmArgs : ["-Dwebdriver.ie.driver.loglevel=DEBUG", "-Dwebdriver.ie.driver.logfile=C:/IEServerlog.log", "-Dwebdriver.ie.driver=<absolute path to /npm/node_modules/protractor/node_modules/webdriver-manager/selenium/IEDriverServer3.4.0.exe>"]
},
specs: ['spec.js']
};
Spec.js:
describe('angularjs homepage todo list', function() {
it('should add a todo', function() {
browser.get('https://angularjs.org');
element(by.model('todoList.todoText')).sendKeys('write first protractor test');
element(by.css('[value="add"]')).click();
var todoList = element.all(by.repeater('todo in todoList.todos'));
expect(todoList.count()).toEqual(3);
expect(todoList.get(2).getText()).toEqual('write first protractor test');
// You wrote your first test, cross it off the list
todoList.get(2).element(by.css('input')).click();
var completedAmount = element.all(by.css('.done-true'));
expect(completedAmount.count()).toEqual(2);
});
});
I experienced this issue with other versions of webdriver-manager.Got resolved on using 3.4.0
webdriver-manager update --versions.standalone=3.4.0 --ie32
Update webdriver-manager to 3.4.0 and start the specific 3.4.0
webdriver-manager start --versions.standalone=3.4.0
You should be able to run in IE 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.