DataDrivenFRAMEWORK: Part 4 | Selenium Python Forum
N
Nitika Posted on 07/12/2020

Please let me know the cause of this error, not able to fix it.

On running same code, I got this error 'GeneKeywords' object has no attribute driver' and also could not see testCases/test_login.py::test_loginn[argVals0]

 

Here is the output,

URL=https://www.zoho.com/
loginlink_xpath=//a[text()='Login']
usernametxtbox_xpath=//input[@id='login_id']
nextbtn_xpath=//button[@id='nextbtn']/span[text()='Next']
passwordtxtbox_xpath=//input[@id='password']
signinbtn_xpath=//button[@id='nextbtn']/span[text()='Sign in']
{'RunMode': 'Y', 'BrowserName': 'Chrome', 'Username': 'U1', 'Password': 'P1'}
PASSED
testCases/test_login.py::test_loginn[argVals1] {'RunMode': 'N', 'BrowserName': 'Firefox', 'Username': 'U2', 'Password': 'P2'}
PASSED
testCases/test_login.py::test_loginn[argVals2] {'RunMode': 'N', 'BrowserName': 'Edge', 'Username': 'U3', 'Password': 'P3'}
PASSED'GenKeywords' object has no attribute 'driver'


N
Nitika Replied on 08/12/2020

I have added the zip file for code


N
Nitika Replied on 08/12/2020

I have added the zip file for code


0
09914040666 Replied on 08/12/2020

Hey, 

The chances of getting this error are either the browser 'Edge' is not opening and not specified, or some keyword is missing from your file. Just to be sure what the error exactly is, please kindly share the GenKeywords.py as well the excel you are using so that I can check.


N
Nitika Replied on 08/12/2020

I have attached the code zip file please look into it.


0
09914040666 Replied on 08/12/2020

Hey, 

The error is in your genericKeywords.py file in openBrowser(). The edge browser is not there in the function. The command to open URL does not find any browser to open URL on, that is why you are getting the error, add that as well, the code will work.


N
Nitika Replied on 08/12/2020

In case if I dont have edge browser in my system then how to fix it, have to remove from excel sheet only?


0
09914040666 Replied on 08/12/2020

Yes, you have to remove it from your excel sheet. If you want to test your code on Edge, then you should install Edge browser in your system. I recommend installing browser.


N
Nitika Replied on 08/12/2020

I have removed the edge browser from excel sheet but still facing the same issue, but i guess if command could not found browser to open url then I should 'driver' not found error.I am not able to figure out this issue


0
09914040666 Replied on 08/12/2020

Just one question i have, is any browser opening?

In your genericKeywords.py file in openBrowser(), the if-elif-else is comparing the browsername with 'chrome', 'firefox' and in the excel sheet the browsernames are given as 'Chrome', 'Firefox'. The conditions did not match, python is case sensitive. Kindly correct this issue and try running your project.


N
Nitika Replied on 08/12/2020

Mam, may be I forgot to edit that before sending you.But now I have corrected it , but still same error is coming.Please check 4th part of DDF, at the end after passing the argVals when you run the code then only values were fetching , browser was not getting open.

Same case is happening in my project but 'GenKeywords' has bo object driver error is also coming up.

Please correct me if I am doing mistakes.


0
09914040666 Replied on 08/12/2020

Please share your updated code and tell the time from the video where error is occuring.


N
Nitika Replied on 08/12/2020

DDF: Part 4, 54:20 at this point when I am printing argVals ,then I am facing the issue.And I have uploaded the zip file


0
09914040666 Replied on 08/12/2020

OK, i got it. "'GenKeywords' object has no attribute 'driver'" this is the exception of trouble right. It is coming from conftest.py. The reason for the error coming is in tear down part, we are giving command to quit the browser. Since till this point, no browser is opened we are just printing the data and no browser is found to be quit. 

Just go to conftest.py and remove the line where exception is being printed. Then no exception will come and you will get this in the console.

Responsive image

Please let me know if the issue is solved after doing the recommended step.


N
Nitika Replied on 08/12/2020

Thanku so much issue has been fixed.

One more thing want to confirm in console I am getting this output .

estCases/test_login.py::test_loginn[argVals0] -- listing properties --
XLSpATH=C:\\Users\\user\\PycharmProjects\\pythonProjectFirst\\DataDrivenFrame\\testResources\\DDF.xlsx
URL=https://www.zoho.com/
loginlink_xpath=//a[text()='Login']
usernametxtbox_xpath=//input[@id='login_id']
nextbtn_xpath=//button[@id='nextbtn']/span[text()='Next']
passwordtxtbox_xpath=//input[@id='password']
signinbtn_xpath=//button[@id='nextbtn']/span[text()='Sign in']
{'RunMode': 'Y', 'BrowserName': 'Chrome', 'Username': 'U1', 'Password': 'P1'}
PASSED
testCases/test_login.py::test_loginn[argVals1] {'RunMode': 'N', 'BrowserName': 'Chrome', 'Username': 'U2', 'Password': 'P2'}
PASSED
testCases/test_login.py::test_loginn[argVals2] {'RunMode': 'Y', 'BrowserName': 'Chrome', 'Username': 'U3', 'Password': 'P3'}
PASSED

 

 

I can see the output for test_loginn[argVals1] and [argVals2] but [argVals0]  is not displaying.Is it fine or having some mistake


0
09914040666 Replied on 08/12/2020

Nothing is wrong. It is fine.


N
Nitika Replied on 08/12/2020

okay thanks


0
09914040666 Replied on 08/12/2020

Your welcome.


Related Posts