TFS 2015 failing to run selenium specflow tests - selenium

I'm struggling to get TFS 2015 to run my selenium specflow tests. The automation is for our production environment so the TFS project doesn't need to deploy the website code, it just needs to run the automation agaist www. (The automation code has the www address coded into it)
I've seen the chrome driver sandbox parameter although that hasn't removed my problem. I've added the following when initializing my chrome driver, shown below
Use of chrome sandbox
var options = new ChromeOptions();
options.AddArguments("–no-sandbox"); // also tried "--no-sandbox"
return new ChromeDriver(options);
TFS Command line build step settings
Tool: packages/NUnit.ConsoleRunner.3.6.1\tools\nunit3-console.exe
Arguments: "../../../My.Automation/bin/Debug/My.Automation.dll" --where "cat=demo
Working folder: $/UAT Automation/Dev/SourceCode
Error experienced on TFS (it works locally on my machine)
I get the same error when I run the command on the server myself.
Unknown error: cannot find chrome driver

Few ideas:
Check repository. Probably you didn't checkout folder with chrome
driver (you have it locally, but not in repo)
You have a path to chrome driver in code, and it is different from the path in TFS server

Related

Running webdriver IEDriver on Jenkins fails

I have a small C# webdriver test suite dll which I recently created...
Runs fine in Visual Studio
Runs from the command line perfectly using the NUnit 3 console runner.
I have Jenkins installed on my laptop (for testing before I put it into my live Jenkins), running with my Windows credentials. When I execute the test suite using the same NUnit3 console runner command I used before, all the tests fail, can't even log in as it can't find any elements. I took screenshots with Selenium & it's just a black rectangle!
Anyone have any ideas on how to get IE behaving - I bet it's a Windows permissions thing from Jenkins. Thanks!
I'll answer my own question.
Turns out you can't do what I'm attempting - it's a known issue with the way IE is built. What I had to do is install a new Jenkins node on another machine and get that to run the IE tests. That way it did work.

Run Selenium Application on different machine than where it was created

I have developed a Console App using VS2015 which uses Selenium WebDriver to test some websites.
I now want to install this app onto a server and run it there.
I have already installed the app on the server, but when I try to run it, I get an error saying that "Firefox binary couldn't be found in PATH or default". Firefox is installed in the default path C:\Program Files\Mozilla.
Have you got any suggestions on this? Do I need to install any part of Selenium on the server? (Selenium Standalone Server for example)
The server is running Windows Server 2012 R2
Looks like it's unable to find the Firefox binary on its own. So you have to specify the binary of Firefox explicitly. Use the below code to find the Firefox binary
FirefoxBinary binary = new FirefoxBinary(new File("path/to/binary"));
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(binary, profile);
What I would recommend is for you to be using Firefox binary in your test suites and call the path of the executable from a properties file so that you don't have to compile all of your test cases again.
The issue was actually caused by the environment variable %PATH%. The variable didn't contain the path for Firefox default installation, which is
C:\Program Files\Mozilla Firefox
To fix the problem, I simply added that path to the environment variable %PATH% (you can find it by clicking Start, typing "environment variables", and clicking on "Environment Variables..." button on the bottom right of the System Properties tab that open when you look for "environment variables" in the Start menu.
That solved the issue.
Thank you Khaja for you answer anyways.

Using Geb and the Edge WebDriver I get failed to create driver from callback

In my current automation project I am attempting to automate my testing based on various browsers using Gradle and Geb. I've been able to get all browsers working with the exception of Microsoft Edge. Currently I am seeing:
geb.driver.DriverCreationException: failed to create driver from
callback
I've verified that I am downloading the MicrosoftWebDriver.exe to the expected directory in my project but I am not sure if I am missing something in my driver setup:
driver = {
EdgeOptions options = new EdgeOptions()
options.pageLoadStrategy("eager")
edgeDriver = new EdgeDriver()
return edgeDriver
}
I am fairly new to Geb and Gradle as a whole so it is entirely possible I am missing something. Any help would be appreciated.
As far as I am aware You need more than just the exe to use the MS Webdriver. The machine that's executing the Webdriver code will need to have one of the following MSI's installed:
For Windows 10 Build 10240, install this version of Microsoft WebDriver.
For Windows 10 Fall 2015 Update, install Microsoft WebDriver Fall 2015 Update.
For the latest preview build from the Windows Insider Program, install this version of Microsoft WebDriver.
I think the MSI changes some switches in Edge to enable it to be controlled by Web driver.
Turns out that my issue was due to having just upgraded my local machine to Windows 10 and the Microsoft Web Driver preview build requires the Fall 2015 update which is unavailable to me for 31 days.

Error in running test case using batch file via selenium IDE

I used Selenium IDE firefox plugin to record a test case then i used '.bat' command line to automate testing using the below command,
java -jar C:\Selenium\selenium-server-standalone-2.48.2.jar -htmlSuite "*firefox" "http://16.52.110.123:8080/AntExample/userRegistration.htm" "C:\Selenium\First_Test_Real_Suite.html" "C:\selenium\logs\Result.html"
the test was perfectly working using the .bat script when suddenly today I am facing this error message in firefox when I run the script
Firefox can't find the file at
chrome://src/content/TestRunner.html?auto=true&multiWindow=true&defaultLogLevel=info&baseUrl=http://16.52.110.123:8080/AntExample/userRegistration.htm&resultsUrl=http://localhost:4444/selenium-server/postResults&test=http://localhost:4444/selenium-server/tests/First_Test_Real_Suite.html.
I am all ears to fix this issue
You are getting this issue due to latest Firefox browser update :)
First Download and Install Previous Firefox Browser Version 42.0 (Link
: Click here)
and Try to execute same Selenium Test cases using Bat file. It will work properly. :)
Also after Installing Firefox browser, Don't forgot to set following option
Goto Tools >> Options >> Advanced Tab >> Update Tab >> select "Never
check for updates (not recommended: security risk)" option to disable
auto update.
Running Selenium Test cases using bat file will work properly once new "Selenium Standalone Server" version get released (Current version is 2.48.2 will work for Firefox 42.0)
upgrade/downgrade to FF 42.0 fixed the error. Thnx guys
This is indeed because Firefox 43 doesn't allow you to run unsigned add-ons. If you insist on using the old Selenium RC Runner and want to run the latest Firefox, you can enable add-ons again by allowing for unsigned add-ons:
In Firefox go to about:config
Look for setting xpinstall.signatures.required and toggle it to false
Now any unsigned add-on will run, including the Selenium RC Runner. Use it at your own risk ;-)

Moving from Selenium IDE to what?

I have been given the following job from my boss:
three years ago a former employee created selenium tests for our project and committed them via eclipse
now I have to update the tests due to the fact that the software has changed through time.
I created new IDE tests, instead of editing the old ones.
I have committed them through CVS in the project folder and I access them via a browser (selenium has some folder in the project)
when I run these tests via IDE, they run fine, but when I run them via the TEstRUnner that is in the old selenium installation, there are a lot of errors.
Should I install new version of Selenium in the project folder and what should it be?
Or should I just run the tests from IDE instead? (I read somewhere that TestRunner will be deprecated)
How are tests made in IDE run through Web Driver?
Have you looked at Selenium Builder? It supports migrating existing scripts, works well with Sauce Labs and there is also a Jenkins plugin](https://wiki.jenkins-ci.org/display/JENKINS/Selenium+Builder+Plugin) available.
Tests built using Selenium IDE are built using Selenium RC (1.0), and selenium WebDriver is the foundation of Selenium 2.0. Selenium has a migration document for this transition. In moving to Web Driver, you might be required to code the tests yourself, rather than using the point and click Selenium IDE.
Additionally, there is a hybrid approach for using Selenium RC code on Selenium Web Driver: http://docs.seleniumhq.org/docs/03_webdriver.jsp#alternative-back-ends-mixing-webdriver-and-rc-technologies
In order to run the Web Driver tests, you will need to have a selenium server or local browser to execute these tests. Some examples are SauceLabs, Selenium Grid, a standalone Selenium Server, or I believe you allow Web Driver to directly control the browser on the computer executing the code.