Image CAPTCHA
Enter the characters shown in the image.

You are here

Switching between Chrome-Driver and Remote-Webdriver

2 posts / 0 new
Last post
Jonathan
Jonathan's picture
Switching between Chrome-Driver and Remote-Webdriver

Switching between Chrome-Driver and Remote-Webdriver in C#

I have used the following line to set up by ChromeDriver locally in C#: 

driver = new ChromeDriver(); 

When I build my code through my continuous integration system (AppVeyor) it fails however. If I understand it correctly I need to change the line to look something like this instead: 

driver = new RemoteWebDriver(new Uri("http://my.url.com"), DesiredCapabilities.Chrome()); 

My question is, is it possible to switch between these automatically?
So that when I run my test locally ChromeDriver.exe will be used and when I run it on my CI RemoteWebDriver will be used? 

Cool

solution 1:
If your CI system is not windows based you can take the OS version and set condition for that.If both are windows you need to figure out some unique thing between those.

solution2:
set up a share folder and both CI and local machine use resources from there. Then you can just use new ChromeDriver(); to instantiate your chromedriver

Please update me with more solutions or other issues that you had with Selenium drivers.

jonathan
Anonymous's picture
Running tests on Google Chrome using Webdriver

While automating your web-application using webdriver, many may have faced problems in executing your cases on Google-chrome. Whenever you try to use webdriver object for executing your cases on chrome using the following code:

DesiredCapabilities capability = DesiredCapabilities.chrome();

you most probably get the following error:
The path to the chromedriver executable must be set by the webdriver.chrome.driver system property; for more information, see... The latest version can be downloaded from http://code.google.com/p/chromium/downloads/list

The solution to this error that has been mentioned in the given URL  "http://code.google.com/p/selenium/wiki/ChromeDriver" is  to set the chromedriver path to the variable "webdriver.chrome.driver". But how exactly to set the path and use it for your test execution is not given there.

For setting the  "webdriver.chrome.driver" value and for using google-chrome to execute your automated tests, you can use one of the following methods:

Method - 1:
Start the selenium server using the following command:
java -Dwebdriver.chrome.driver=/path/to/chromedriver  -jar selenium-server-standalone-2.7.0.jar

And in your Java code you use the chrome driver in the following way:

DesiredCapabilities capability = DesiredCapabilities.chrome();
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);

The advantage of using this method is that you can execute your test-cases in a remote machine and this is advantageous when you want to run it on grid.

Method - 2:
Set the system property  "webdriver.chrome.driver" using System.setProperty()  in your code and then try to execute your cases on Chrome.

System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
WebDriver driver = new ChromeDriver();

This method works well when your tests are getting execute on a local machine and you are not starting any selenium server.

found it in blog http://blog.varunin.com/2011/10/running-tests-on-google-chrome-using.html

Log in to post comments

MANUFACTURERS Wallboard

View MANUFACTURERS Wallboard

Total Manufacturers in our archive: 280
Testing tool manufacturers world-wide list
10Levels ABID CONSULTING AccelQ Accord Software ActiMind AdaCore
AdaLog AgileLoad AgileWay Agitar Algorismi ALL4TEC
Andreas Kleffel Android Apache Apica Apollo Systems AppAssist.mobi
Applitools AppPerfect Appsee ApTest Assertible Assure
Atlassian AutoIt Consulti .. Automation Anyw .. Automation Cons .. Axosoft Aztaz Software
Backtrace I/O Badboy BlazeMeter Borvid BrowserStack BSQUARE
BStriker Intern .. CA Technologies Canonical Canoo Engineeri .. Catch Software CelestialTeapot
Chris Mallett Cleanscape ClicTest CloudQA Codeborne CodeCentrix
CodePlex projec .. Codoid Cogitek Compuware Configure IT Conflair
ConSol Core Services Coronys Ltd Countersoft CresTech Softwa .. CrossBrowserTes ..
Crosscheck Netw .. Crowdsourced Te .. Cucumber Ltd Cyara Cygnet Infotech DareBoost
Databene Datamatics Glob .. DevExpress DTM soft Dynatrace LLC EasyQA
Eclipse EkaTechserv Elvior Emmanuel Jorge Empirix EPAM Systems
Equafy Esterel Technol .. eXept Software .. Experitest Finaris Froglogic
FrontEndART Ltd GeneXus GitHub project gnoso Google Code Pro .. GrammaTech
Gurock Software HelpSystems HENIX Hewlett Packard .. Hexawise High-Tech Bridg ..
Hiptest Hitex IBM Rational imbus Shanghai Impetus Inflectra
informUp InTENSO - IT Ex .. Ipswitch Jamo Solutions Janova JAR Technologie ..
JBoss Developer jClarity Jellly.io JetBrains Jively jQuery foundati ..
JS Foundation Jspresso Kanoah KMS Technology Kualitee LDRA Limited
Litmus LoadFocus Loadster Perfor .. MarathonITE Marketcircle Marketcircle
Maveryx Meliora Ltd Micro Focus Sof .. Microsoft Mobile Labs Mobile1st
Mockaroo, LLC Monkop Mozila MSys Technologi .. Navicat NeoTys
Neowise Softwar .. NetCart NORIZZK.COM Novosync Mobili .. NRG Global NTT Resonant
OC Systems Odin Technology OpCord Oracle Orcanos Original Softwa ..
OW2 PANAYA Parasoft PassMark Patterson Consu .. Perfecto Mobile
Pivotal, Inc. Plutora Postman (API To .. PractiTest PrimaTest Process One
Programming Res .. Psoda PureLoad PushToTest Python Q-Assurance
QA Systems QACube QASymphony QAWorks QMetry Quali
Qualitia Softwa .. Quality First S .. Quotium RadView Softwar .. Ranorex RedLine13
Reflective Solu .. ReQtest RevDeBug Robotium Tech Rogue Wave Soft .. Rommana Softwar ..
RTTS ruby-doc.org Runscope Sandklef GNU La .. Sauce Labs Seapine Softwar ..
SeleniumHQ Sencha Sensiple Siemens PLM Sof .. SmartBear Softw .. SmarteSoft
SOASTA SoftLogica Softomotive Softsmith Solution-Soft SonarSource
Sourceforge Spirent Technol .. SQS Software Qu .. Square Stimulus Techno .. Swifting AB
Synopsys T-komp T-Plan TechExcel TechTalk Telerik By Prog ..
Tellurium Test Collab Test Goat Test Recon TestCaseLab testCloud.de Gm ..
TestCraft Techn .. Testenium Testim.io TestingBot TestLodge Testmunk
Testomato TestOptimal TestPlant TestPro Testsigma Techn .. Testuff
The Core Bankin .. The MathWorks The Open Group thePHP.cc Thoughtbot Thoughtworks
Tigris.org Time Simulator Top-Q Trace Technolog .. TrendIC TRICENTIS
Tritusa Pty Ltd TWD Solutions P .. TypeMock Tyto Software Ubertesters UniTESK
Universal Test .. Usetrace Ltd Utrecht Univers .. Validata Group Vanamco AG Vector Software
Veracode Verifaya Corpor .. Verit VersionOne Viewlike.us Vornex Inc.
Watir.com WcfStorm Soluti .. We Are Mammoth Web Performance .. Wintask Wireshark Found ..
Worksoft Xceptance XK72 Xpand IT XQual ZAPTEST
Zeenyx Software .. Zephyr Zeta Software zutubi pty

Selenium Youtube Playlist

Theme by Danetsoft and Danang Probo Sayekti