How exactly does one automate internet explorer tests with selenium grid? - selenium

I have a GoCD server that I plan on running my selenium test suite on. This machine is a Linux machine. So.. I set up selenium on a windows machine. The key problem I am having is that when running as a service, or a scheduled task, the selenium hub does not launch IE.
If I remote desktop into the machine, run the jar manually from command line, the browser launches in my RDP session and the tests all pass. If I install it as a service (With permissions to interact with the desktop!) the driver appears to run, but the content never loads.
So if you have an answer, please remember:
The grid works for all browsers with an interactive desktop session open.
Without an interactive desktop session, Chrome and Firefox tests still pass (in headless mode).
I am using no selenium nodes, I am only using the standalone jar (not running as hub or node, just running the tests standalone.
I am using version 3.14 of both selenium standalone and IEDriverServer.exe
I know that tons of people do automated IE tests with selenium, but how do they do it with Hub on windows?
I've tried literally every options setting I can see to try to phinigel a way to get it to work, but it's just not having it.
I also tried running as a scheduled task rather than a service, no dice there either.
This is the precise error the IETests are presenting:
Oct 09, 2018 1:15:12 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: W3C
org.openqa.selenium.TimeoutException: Expected condition failed: waiting for value to contain "sign-in.host.com". Current value: "null" (tried for 10 second(s) with 500 milliseconds interval)
at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:113)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:283)

I used to have issues with IE selenium tests on a VM in azure. What i noticed was that while RDP to the machine everything worked fine but when i closed the session all tests failed.
What i ended up doing was leaving a logged in console session after every RDP closing.
After adding a trigger on session log off i run a powershell script with the following:
Tscon 1 /dest:console
This keeps an active desktop session and my tests on IE pass.

Related

Failing the automation script in Jenkins due to difference in screen size

I connect remote windows server in Jenkins by node&slave concept and I create a "freestyle" job and run batch command in Jenkins in that command I wrote selenium scripts. the job was working fine.
When a test fails it takes a screenshot of the browser window. Unfortunately, the browser is always a fairly low resolution: 1024 x 656.
If I run the tests manually within the VM (logging in and running them outside of Jenkins) then they're run at the desktop resolution of the login.
So, my question: how can I set the screen resolution that is used when the tests are run by the Jenkins Service? Is this possible?

How to run the selenium server in the background using robotframework?

So the concept is like this -
I would like to run the selenium server .jar file on a remote windows machine.
Then connect to it via the default port (:4444), open browser and navigate to a URL of my choosing.
I have everything working except the part of running the selenium server through robot.
This keyword works as far as I can tell (until the open browser keyword) -
Start Selenium Server
&{client} = Return Internal Host
Connect Environment Machine Windows ${client}
start process java -jar ${/}SeleniumServer${/}selenium-server-standalone-3.141.59.jar alias=seleniumserver
process should be running seleniumserver
open browser http://example.com/example.html chrome None http://1.1.1.1:4444/wd/hub
BUT, when I try to connect to the selenium server I get the following error -
"No connection could be made because the target machine actively refused it"
It seems like the process either does not run or runs for a short amount of time then closes.
What am I missing here?
If I manually start the server on the client, everything works. It opens the browser and does whatever I need. (manually running the java -jar selenium*.jar on the cmd)
But when I run this Start process keyword, that should keep the process running in the background, I get connection refused. Any Ideas?
Another piece of information that might be useful - The selenium server should throw an error if trying to run it twice on the same machine (because of the used port bind 4444).
When running the keyword shown above, while there is a selenium server up and running on the target machine, the test still passes for some reason. Not sure if it is even running the process as intended but the "process should be running" keyword seems to pass.
Thanks!

HTTP request to the remote WebDriver timed out after 60 second - IEDriver - Selenium C#

I have a Selenium automation suite up and running with chrome which works like a charm. I have integrated IEdriver within. After integrating I executed few of the test cases and getting problem with the execution on IE11. I observed that my test fails with the exception "HTTP request to the remote WebDriver timed out after 60 seconds" . This behavior is random for every run and in continuing tests, pop up window is always logged out in application. Did anyone face similar problem?
You could maybe increasing the timeout?
InternetExplorerDriver driver = new InternetExplorerDriver(#"c:\pathtoie", options, TimeSpan.FromMinutes(2));
I was doing development and test execution on VM and whenever I lock my system, the script hangs on the VM. So doing execution on a VM from different VM will solve the problem.

Selenium WebDriver tests fail with System.Net.WebException Unable to connect

I'm working on a suite of Selenium WebDriver (not Selenium RC and not using Selenium-Server) tests that are being executed by a command-line call to MSTest. I've broken them into test classes for each browser we plan on testing (Chrome, Firefox and IE9, for now) and each test class has a startup method that logs in to the system under test and then executes the test(s) requested and a TearDown method that closes the browser using WebDriver.Quit().
On my development machine everything is hunky-dory, but on our build machine the class initialization/start-up method executes fine and logs into the site, but as soon as the first actual test starts the test runner closes with the error message:
OpenQA.Selenium.WebDriverException: Unexpected error. System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: No connection could be made because the target machine actively refused it 127.0.0.1:59982
obviously the port changes depending on which browser's being tested; when I run the whole suite I get errors on different ports for the tests for IE, Firefox, and Chrome - two errors for each browser (as the suite currently has two tests for each browser)
Windows Firewall is off for the build machine, and checking netstat before running the tests shows that the port's not in use; if I debug the tests and stop after the startup code runs but before the test runs, of course the port is in use. 127.0.0.1 and localhost are the same as well.
I get the same error whether or not I call the test via the command line, run/debug it from within Visual Studio using the VS Test tools, or by executing my console app, which calls MSTest via Process.Start(). The exception is thrown on the first FindElement() call.
Where can I start looking to figure out why this is failing on the build machine and not on my dev box?
The issue here was that in trying to implement some more robust error handling during startup I place a call to the Teardown code in the finally block of a try/catch wrapped around the login code, so as soon as the test harness was done logging in I was closing and cleanin up the WebDriver instance, so when the test ran there wasn't a WebDriver there to communicate with.
I suspect when I as looking at the "same" code on my dev machine the libraries that were actually running didn't have that block in them.
When you run an application from Visual Studio it fires up a server listening on a certain port. In your case 59982.
You need to actually have your web application running on its own on the test environments before running your test against it.
On your dev machine your application is running on that port. I'm guessing on your remote machines that is not the case.

Selenium with hudson:firefox browser is not getting lanuched while selenium scripts are running through hudson

i integrated my selenium scripts (using junit) with Hudson. i invoked my job through ant . My problem was my scripts are running successfully but the fire fox browser is not getting opened. At this moment i am not using selenium grid .please provide any suggestion
Check whether you run Hudson as a service using your own account. If you want to see Firefox browser you must select Local System Account as a service runner (Log on option in service properties) Then there is a possibility to check interact with desktop checkbox and it makes browser "visible" while running your tests.