0

hey guys I have started learning robot framework using python, so I did a simple test of opening a google page. So when I did it showed webdriver missing, I was like shoot how can I miss this, I installed webdrivermanager using pip and searched on google how to use webdrivermanager in robot it showed me this link: How to use Webdriver manager in Robot Framework?. followed the validated answer as it is but I get an error saying file is absent like this:

Error in file 'C:\Users\avdhu\OneDrive\Documents\Robot\Tests\Google\search.robot' on line 4: Library 'chromedriversync.py' does not exist. Now I am confused , please help me

Directory structure:

Directory Structure

My code:

search.robot

*** Settings ***
Library  SeleniumLibrary
Library  chromedriversync.py
# Resource

*** Variables ***

*** Test Cases ***
This is sample test
    [ documentation ]   Google test
    [Tags]    
    ${chromedriver_path}=   chromedriversync.Get Chromedriver Path

    Open Browser          https://pypi.org/project/webdriver-manager/            executable_path=${chromedriver_path} 
    Close Browser
    
   

*** Keywords ***

Image of above code:

Robot file

chromedriversync.py

from selenium import webdriver
from webdrivermanager.chrome import ChromeDriverManager

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

Chromedriversync.pyr.com/NIojq.jpg

1 Answers1

0

In the example you found, probably robot and python files are in the same folder. If you move the python file to Tests\Google, for the sake of testing, it'll probably work.

But the solution you're looking for is informing the relative path:

Library            ../../resources/chromedriversync.py
FortCWB
  • 5
  • 6