Selenium test not running when started by Jenkins - python

I have some tests written in pytest with selenium webdriver. It points to a selenium grid browser node to run the test. When i run the test from local terminal (py.test test_login.py), it will connect to the selenium grid correctly, open up the browesr and run the test.
Switching over to Jenkins, we set a job to create a build and run the same selenium tests. However, it will open the browser (chrome or firefox) but it will not run the test, it just eventually failed with timeout error. Everything is on the same network and behind the firewall. Does anyone know why the test wont run when invoked from Jenkins? It doesnt seem to be a network issue as it was able to open up the browser on the grid node.

Related

Cross browser testing using selenium python

I have written a cross browser testing test script using selenium python.
while running the test script in chrome it is working fine,
but running the code in Firefox its opening the browser and launches the application but after that it shows like (Move Target Out Of Bounds Exception) error it throws why? even it is working fine in the Microsoft edge also. but not in Firefox driver.

How do you run Chrome while selenium headless script is executing on mac?

I have a python selenium script that uses chromedriver in headless mode to test links on a website. I'm running this script on MacOS High Sierra.
If I have Chrome open prior to running the script, I can continue to use the browser normally. Headless mode appears to isolate me from the testing. However, if Chrome is closed first, I cannot launch the browser while the selenium script is running.
Looking at Activity monitor in the first scenario, it appears to me that chromedriver creates a new process for Chrome to run. So I (perhaps incorrectly) assumed I should be able to launch the browser manually while the script is running.
What am I missing?
How do I launch Chrome while selenium is running on Mac?
Ah-HA!
This post I stumbled upon made it possible to open Chrome while selenium is running (although I don't understand why it works one way but not the other).
For most applications, launching with open -naF "App Name" or open -nF
/path/to/application.app should be sufficient (see Safari, Forklift,
Office apps, etc.).
-n opens a new instance
-a tells open to look in the list of registered apps (no need to specify the full path, but can go wrong if you have multiple versions
of an app. I sometimes see issues on my system with differentiating
between macOS apps and apps installed by Parallels OSes… I prefer to
specify the path directly.)
-F opens a fresh instance (ignores an app save state left over from previous instances)

Selenium Grid + Jenkins + Python -> Headless RemoteWebDriver?

I'm currently working with Jenkins + Selenium Plugin for Jenkins. I have a hub and some nodes. Both Hub and Nodes are in my localhost.
I realized that, when I run my tests locally (That means, using chrome, firefox, IE webdrivers), then the browsers will appear and the tests will be executed.
driver = webdriver.Chrome() # Open Chrome Browser
On the other hand, if I run the tests through a remote webdriver, then the browsers appear to be headless.
capabilities = {"platform" : "VISTA"}
capabilities["browserName"] = "chrome"
driver = webdriver.Remote(command_executor='http://localhost:4444/wd/hub', desired_capabilities=capabilities)
# Hub and Node are running locally, windows chrome won't open (Headless?)
Are these remote browsers (selenium grid) "headless" by default?
How could I verify if they're really running in headless mode?
If they are not headless, how can I make them headless? (jenkins +
selenium grid)
I've been trying to do some research but can't find any documentation that specifies this. I just found this post:
http://grokbase.com/t/gg/selenium-users/15b64b173p/selenium-grid-browser-appears-headless
Thanks!
RemoteWebDriver is not headless by default, it is running where you want it to run, it can run on user account as a normal browser or it can run in background on LocalSystem account.
Which OS are you using? If you are running jenkins as a windows service your test will run in background, it's normal behavior because of windows service 0 policy.

Selenium Webdriver works fast when network/internet is turned off

I am facing a very peculiar issue with Selenium Webdriver. All of sudden my selenium scripts written in python have started to execute very slow in both firefox and chrome.
The script execution returns to its normal speed when I manually turn off the network/internet through my laptop's wifi button after a webpage is loaded. The same scripts run at normal speed on another computer (on my office network) where I connect to internet through VPN.
Another example is when I run my scripts on a locally stored webpage file (htm). The scripts run superfast when internet is turned off but run equally slow when the internet is turned on.
I do not use a proxy server.

Selenium crashes Chrome when running from Jenkins

Hi used python selenium for Web Automation and launched that python script from jenkins in MAC.
It will load the Chrome and automation goes for some extent and get error message as
"Aw Snap" page comes up a few steps into the first test
How to fix it

Categories

Resources