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.
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.
There are two web driver managers as shown below,
command-line step -
webdrivermanager chrome:2.38 firefox opera:v.2.35
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!!!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With