Reputation: 13
I tried to have a separate file for browser driver, in my driver file with a file name driver.py:
from selenium import webdriver
class MyDriver():
def __init__(self):
self.driver = webdriver.Firefox()
I try reusing it on another file here's the code:
from driver import MyDriver
driver = MyDriver()
driver.get('http://google.com')
However, I always got an error:
AttributeError: 'MyDriver' object has no attribute 'get'
Upvotes: 0
Views: 60
Reputation: 31
You simply forgot to add another driver. Try this:
driver.driver.get('http://google.com')
Upvotes: 1