AttributeError: 'str' object has no attribute 'path'

Hi everyone, I am facing following error, despite path of chromedriver is correct.

My script:
*** Settings ***
Documentation To validate the login form
Library SeleniumLibrary

*** Test Cases ***
Validate UnSuccesful Login
open the browser with the Mortgage payment url

*** Keywords ***
open the browser with the Mortgage payment url
Create Webdriver Chrome service=C:\Users\HP Pavilion\Documents\chrome\chromedriver
Go To LoginPage Practise | Rahul Shetty Academy

Errors:
Robotframework.Tests.testDemo1 :: To validate the login form

Validate UnSuccesful Login | FAIL |
AttributeError: ‘str’ object has no attribute ‘path’

Robotframework.Tests.testDemo1 :: To validate the login form | FAIL |
1 test, 0 passed, 1 failed

Robotframework.Tests | FAIL |
1 test, 0 passed, 1 failed

Robotframework | FAIL |
1 test, 0 passed, 1 failed

Hi Rauf,

Start with the simple things (Though this may just be an issue with when you pasted in the forum, I don’t know so just in case)

Make sure you’ve escaped the backslash in your windows paths:

Create Webdriver Chrome service=C:\Users\HP Pavilion\Documents\chrome\chromedriver

Should be:

Create Webdriver    Chrome    service=C:\\Users\\HP Pavilion\\Documents\\chrome\\chromedriver

Beyond that, the next step would be open the log.html file generated by this failed test and see whether the error is coming from Create Webdriver or Go To, knowing this will help to figure out the problem, and maybe it will have some extra detail.

Dave.

Hi Dave,

Many thanks for your response,

Can you please see attached screenshot from report. Actually, I am new with python and hardly read result.

Hi Rauf,

I’m not that knowledgeable on SeleniumLibrary, and with my limited usage of SeleniumLibrary I never used the Create Webdriver keyword myself only the Open Browser keyword, so I may not be the best person to help but I’ll try.

The error is coming from Create Webdriver which is where I suspected it might be so that’s a good start.

First question is your chromedriver.exe file is it at

  • C:\Users\HP Pavilion\Documents\chrome\chromedriver.exe
  • C:\Users\HP Pavilion\Documents\chrome\chromedriver\chromedriver.exe.exe
  • or somewhere else?

I’d try replacing the service= path with the full path to the exe file including the filename and .exe extension

Next where did you get the syntax of service=? I don’t see it in the documentation or any online examples, the examples I found use executable_path=, so Maybe you should try something like this:

Create Webdriver    Chrome    executable_path="C:\\Users\\HP Pavilion\\Documents\\chrome\\chromedriver.exe"

Hopefully that helps,

Dave.

Hi Rauf,

You can use as below without any attribute

`Create Webdriver     Chrome    C:\Users\winuser\Downloads\Chromedriver.exe`