Automated tests too slow on Jenkins - google-chrome

I'm running Selenium Webdrive tests on Jenkins (Debian 9 without GUI) using Chromedriver and xvfb, and they are extremely slow as compared to local execution. A click is done in 4 minutes comparing to 300 ~ 400 milliseconds on my local machine.
the details of the environment are as follows :
Jenkins (running on Debian 9 without GUI) + Xvfb
Chrome = 67.0.3396.99
Java.version: '1.8.0_171'
Chromedriver Version: 2.40.565383
Selenium-java = 3.13.0
(The test project is in java (maven) with the framework TestNg v6.14.3)
I tried also Firefox, it's not as long as Chrome but it's still long compared to local
Any ideas ?

Try these two ChromeOptions:
options.addArguments("--proxy-server='direct://'");
options.addArguments("--proxy-bypass-list=*");
I found it here :

Related

Sikuli script does not run on Linux

My SikuliX script run on Windows10. However, under Linux (Debian 7.11), the script only opens my application and refuses to continue to execute the remaining script. I tried running on SikuliX versions 1.1.4 and 2.0.1.
Gives an error message:
“[Error] App.isRunning: '[ps, -p, -1]' Process exited with an error: 1
(Exit value: 1)”
Please tell me what is the matter here and is it possible to fix this error?
System Information:
Debian OS 7.11
/usr/local/share/OpenCV/java/libopencv_java320.so
/opt/opencv/opencv-3.2.0/build/lib/libopencv_java320.so
I have java -version installed:
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
Here is my script:
uc = App("/opt/UniversalReader/UniversalReader-v3.9.22_x64")
uc.open()
if not uc.isRunning(10): # wait max 10 seconds
exit(1)
wait(0.3)
mTL = find("Iconuc.png") # find top left.
mBEx = find("PrimerBtn.png")
hover(mBEx.getCenter().click())
while not exists("Listofexamples.png"):
sleep(5)
click("findTestDatabtn.png")
for x in findAll("Closebtn.png"):
sleep(1)
click("Closebtn.png")
click("Closebtn.png")
click("Closebtn.png")
mClbtn = find("CloseBtnPanel.png")
click(mClbtn)
while not exists("WinClose.png"):
sleep(5)
click("NoBtn.png")
mExitBtn = mTL.nearby(1000).right().find("ExitBtn.png") # find top right
click(mExitBtn)
while not exists("WinExit.png"):
sleep(5)
click("NoBtn.png")
This is RaiMan from SikuliX - sorry for the delay (you already asked on Launchpad).
Apparently the feature App.isRunning() does not work on Linux as expected. So I take it as a bug.
You should wait for your app to be ready in another way.
You might e.g. check visually or by looking for a text on the screen.

Selenium Timedout Exception while running test cases from Jenkins

Am running a set of test cases from Jenkins. All the test cases are failing with org.openqa.selenium.TimedoutException on all the functions. I have tested the same code using eclipse in local and its executing fine. Please check on the below error and help on resolving this issue
Configurations:
Selenium- standalone - jar - 2.53
Chromedriver - 2.36
Chrome Browser - 65
testng jar = 6.8
Code Sample:
WebDriverWait wait = new WebDriverWait(driver, 1000);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(ORCollection.get("BtnMDUEligibilityClick").toString())));
WebElement el = driver.findElement(By.xpath(ORCollection.get("BtnMDUEligibilityClick").toString()));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", el);
WebElementClick(" ",ORCollection.get("BtnMDUEligibilityClick").toString());
Thread.sleep(10000);
Logs:
org.openqa.selenium.TimeoutException: Timed out after 40 seconds waiting for visibility of element located by By.xpath: //button[contains(#class,'js-submit')]
I have increased webdriver.wait value in code from 40 seconds to 1000 but still we are getting the same error as Timedout.
I assume that your XPath expressions are correct and you can manually open the browser on the Jenkins slave machine.
The issue could be connected with the lack of interactive desktop. This could happen if you have installed Jenkins on the slave machine as windows service. The recommended for Windows way to control a Windows slave is by using Launch slave agents via Java Web Start. More info here and here.

Karma test error after updating Chrome

This morning I ran my unit tests and everything worked as expected with some tests failing and several passing. Then I updated Chrome to version 55 and suddenly I receive the error below, and none of my tests even run:
WARN [karma]: No captured browser, open http://localhost:/
System configuration:
OS: Windows 10
IDE: VSCode 1.7.2
Karma 1.2.0
Add below lines of code to make it work .
mime: {
'text/x-typescript': ['ts', 'tsx']
}
Source: https://github.com/angular/angular-cli/issues/2125

cannot run Selenium tests on some browsers

i have tests made with Mink using Selenium 2 driver. everything is working OK under Windows 7 with Firefox, Chrome and IE and Ubuntu 12.10 with Firefox. the problems are:
when i try to run test on Opera (Windows 7) it launches but it cannot find any element on the page - the test fails.
when i try to run test on Chrome (Ubuntu 12.10) using chromedriver - the system returns an error "An unknows server side error occured while processing the command".
when i try to run test on Opera (Ubuntu 12.10) - the system returns an error "No response in timely fashion".
what am i doing wrong? how can i make work Opera in Windows and Opera and Chrome in Ubuntu?
p.s. i use system as Selenium Grid 2
For me on Windows it work:
java -jar "c:\selenium-server-standalone-2.35.0.jar" -forcedBrowserMode "*googlechrome c:\Program Files\Google\Chrome\Application\chrome.exe"
May be for u:
java -jar "c:\selenium-server-standalone-2.35.0.jar" -forcedBrowserMode "*opera c:\Program Files\pathToOpera.exe"
It might be a matter of Operative System as well.
I am developing on a Windows machine and my colleagues are working on Mac.
They had just included the chrome driver for mac, so tests didnt´t work on my computer.
I had to do this:
if (OS.indexOf("win") >= 0) {
System.setProperty("webdriver.chrome.driver", "src/test/resources/selenium_drivers/chromedriver.exe");
} else if ((OS.indexOf("mac") >= 0)) {
System.setProperty("webdriver.chrome.driver", "src/test/resources/selenium_drivers/chromedriver");
}
Two different driversa that you can find at http://chromedriver.storage.googleapis.com/index.html

Error using ChromeDriver when kicked off from teamcity

I was having trouble with firefox for my watir-webdriver tests and decided to move over to CHROME. This runs fine local dev box, however when kicked off from team city on our qa server I get the following error:
This is using the same chromedriver as on dev box.
Windows 2003 Server 32 bit
Chrome 14.0.835.186
chromedriver_win32_14.0.836.0.zip ChromeDriver server for win32
Ruby 1.8.7
watir-webdriver 0.3.4
selenium-webdriver 2.7.0
watir-page-helper 0.3.0
Error
[15:57:06]: Started ChromeDriver
[15:57:06]: port=1203
[15:57:31]: .\test\automation\proxy_launcher.cc(89): error: Value of: app_launched
[15:57:31]: Actual: 1
[15:57:31]: Expected: AUTOMATION_SUCCESS
[15:57:31]: Which is: 0
[15:57:31]: Error while awaiting automation ping from browser process
[15:57:56]: .\test\automation\proxy_launcher.cc(223): error: Value of: automation()->GetBrowserWindowCount(&window_count)
[15:57:56]: Actual: false
[15:57:56]: Expected: true
I believe your problem is you're running the TeamCity agent as a service, try manually running the agent using the instructions on: http://confluence.jetbrains.net/display/TCD5/Setting+up+and+Running+Additional+Build+Agents#SettingupandRunningAdditionalBuildAgents-StartingtheBuildAgent
I'm not using TeamCity or Watir, but I had the same error message from webdriver (using selenium server) running under a windows service.
The solution that worked for me was to run the service under another account and not the system account. Might be worth a try?