Jump to content

How to change the chromepath for WebDriver


Go to solution Solved by Jotos,

Recommended Posts

Heya,

I have been exploring various forums and documentation, but haven't found a clear solution yet.

Could anyone here provide some guidance or share their experiences with changing the Chrome Path for WebDriver?

I would like to use another Version of Chrome for my script.

 

Thanks

Link to comment
Share on other sites

1 hour ago, Danp2 said:

Hi... this is covered in the FAQ section of the Wiki (see my sig for link). Have you checked there yet?

Yhea, I tried this:

 

Func SetupChrome()
    ShellExecute(@ScriptDir & "\Include\chromedriver.exe", "","","", @SW_HIDE)

    _WD_Option('Driver', 'chromedriver.exe')
    _WD_Option('Port', 9515)
    _WD_Option('DriverParams', '--verbose --log-path="' & @ScriptDir & '\chrome.log"')

    _WD_CapabilitiesStartup()
    _WD_CapabilitiesAdd('alwaysMatch', 'chrome')
    _WD_CapabilitiesAdd('w3c', True)
    Local $pfad = 'C:\\Program Files\\Google\\Chrome Beta\\Application\\chrome.exe'
    _WD_CapabilitiesAdd('binary', $pfad)
    _WD_CapabilitiesAdd('excludeSwitches', 'enable-automation')
    Local $sCapabilities = _WD_CapabilitiesGet()
    Return $sCapabilities
EndFunc   ;==>SetupChrome

 

but get an error.. 

Link to comment
Share on other sites

12 minutes ago, Jotos said:
    ShellExecute(@ScriptDir & "\Include\chromedriver.exe", "","","", @SW_HIDE)

I'm not sure why you would have this here. It isn't needed as _WD_Startup will launch the webdriver when it is executed. FWIW, the console will automatically be hidden if the debug level is below $_WD_DEBUG_Info. You can also use _WD_ConsoleVisible to hide / show the webdriver console.

You should put the full path to the chromedriver executable in this line --

_WD_Option('Driver', 'chromedriver.exe')

 

Quote

but get an error

My crystal ball is broken, so you'll need to provide more details about this error if you want further assistance. 😉

Link to comment
Share on other sites

$sCapabilities = SetupChrome()
$sSession = _WD_CreateSession()


_WD_CheckContext($sSession, False)
If @error Then MsgBox(0,"_WD_CheckContext($sSession, False)","Error: _WD_CheckContext") ;return if session is NOT OK

image.png.33e2530cfa6d7b8fd5f1e697e948396e.png

 

I think it's because of the chromedriver.exe don't have the right version. 

Atm I use version 120.0.6099.217 for Chrome and the last stable version for the chromedriver is: 120.0.6099.109 

That's why I wanted to change the path for a beta version of Chrome.

 

The script worked a few weeks ago and everything was fine :D Now it's broken.. 

Edited by Jotos
Link to comment
Share on other sites

You also have the option to have the correct driver downloaded automatically. In your case, it would be something like this: _WD_UpdateDriver('chrome_legacy', @ScriptDir & '\Include', TRUE)
 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...