Here I have an object in which I instantiate several Selenium WebDrivers to control a series of browsers from Selenium Grid.
drivers = {
0: webdriver.Remote('http://localhost:8080/wd/hub' , webdriver.DesiredCapabilities.FIREFOX.copy()),
1: webdriver.Remote('http://localhost:8080/wd/hub' , webdriver.DesiredCapabilities.FIREFOX.copy()),
2: webdriver.Remote('http://localhost:8080/wd/hub' , webdriver.DesiredCapabilities.FIREFOX.copy()),
3: webdriver.Remote('http://localhost:8080/wd/hub' , webdriver.DesiredCapabilities.FIREFOX.copy()),
4: webdriver.Remote('http://localhost:8080/wd/hub' , webdriver.DesiredCapabilities.FIREFOX.copy())
}
What I want to then do is pass those drivers by reference to another method. Like so:
for driver in drivers:
self.create_account(driver)
However I get the following error from Selenium when I get into the create_accounts method:
driver.get("http://google.com")
AttributeError: 'int' object has no attribute 'get'
I assume this is because I'm not passing the object reference properly, and its somehow transferring as an integer as opposed to an object with methods I can call. Is what I'm attempting to do possible in Python? Is there some other way that I should be doing this, or is what I am attempting to do simply not possible?