4

In selenium I used webdriver manager through a command:

driver = webdriver.Chrome(Chromedrivermanager().install())

Is there a webdriver manager use for the robot framework? I would like the webdriver manager to download automatically when running the test script without additional interference.

Jakub Sagan
  • 53
  • 1
  • 1
  • 6

4 Answers4

8

My solution for using this with Robot Framework was with a python library that I called chromedriversync.

chromedriversync.py:

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

def get_chromedriver_path():
    driver_path = ChromeDriverManager().install()
    print(driver_path)
    return  driver_path

Then, in my robotframework tests, I add

Library  chromedriversync.py

${chromedriver_path}=   chromedriversync.Get Chromedriver Path
Create Webdriver    chrome   executable_path=${chromedriver_path}
Go to  www.google.com

I just use the chromedrivermanager install method's returned path variable, to supply to the Open Browser Robot Framework keyword.

Dale
  • 96
  • 1
  • 2
  • It works great, the only thing I've changed was Open Browser, not Create Webdriver. Remember that Open Browser works only for chrome and ff. – Jakub Sagan Nov 04 '20 at 21:11
3

There are two web driver managers as shown below,

  1. If you use this one, you need to do one additional step on the command line, you cannot proceed with the test code unless you execute the below command, as this is part of the webdrivermanager setup. webdrivermanager - webdrivermanager 0.7.4

command-line step -

webdrivermanager chrome:2.38 firefox opera:v.2.35
  1. webdriver-manager 2.3.0

You need to do the following to use webdriver-manager, did you notice something, there is nothing which needs to be done anything specific to webdriver-manager, BEAUTY of making use of robotframework. nice!!!

code

1. pip install webdriver-manager robotframework robotframework-seleniumlibrary
(prjenv) 09:37 PM##~::>pip list
Package                        Version
------------------------------ ----------
certifi                        2018.11.29
chardet                        3.0.4
colorama                       0.4.1
configparser                   4.0.2
crayons                        0.3.0
idna                           2.8
pip                            19.2.3
requests                       2.22.0
robotframework                 3.1.2
robotframework-seleniumlibrary 4.1.0
selenium                       3.141.0
setuptools                     40.8.0
urllib3                        1.25.6
webdriver-manager              2.2.0
wheel                          0.32.3
2. create a file sample.robot
***Settings***
Library         SeleniumLibrary

***Test Cases***
Sample Webdriver
        [Tags]  wd0
        [Documentation] Sample invocation using WD
        Open Browser    http://google.com       ff
        Close All Browsers
3. execute the file as follows
robot *.robot

Output
========

(prjenv) 09:38 PM##~::>robot *.robot
==============================================================================
Sam
==============================================================================
Sample Webdriver :: Sample invocation using WD                        | PASS |
------------------------------------------------------------------------------
Sam                                                                   | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Output:  /Users/apachemain/output.xml
Log:     /Users/apachemain/log.html
Report:  /Users/apachemain/report.html

THAT'S IT!!!

forkdbloke
  • 1,505
  • 2
  • 12
  • 29
2

The only thing that i found in internet is that Youn need to install webdrivermanager with command :

pip install webdrivermanager 

and you launch this command before your script:

webdrivermanager chrome 
robot --outputdir ./results/Robot-results ./TestSuits/*

NB: your browser (Chrome) has to be updated too : (Ubuntu)

sudo apt-get update
sudo apt-get install google-chrome-stable
Miya
  • 41
  • 6
0

in the cmd terminal

pip install webdrivermanager webdrivermanager firefox chrome --linkpath /usr/yourdir

as for automatic updates you could make a batch file .bat (just cmd input) with the last command (it will update the version automatically) and set it to a windows scheduler

https://www.windowscentral.com/how-create-and-run-batch-file-windows-10

https://www.digitalcitizen.life/how-create-task-basic-task-wizard

A. Kootstra
  • 6,827
  • 3
  • 20
  • 43