def getDriver(self):
count = 0
while(True):
try:
ce = "http://%s:4444/wd/hub" % os.environ["HUB"]
driver = webdriver.Remote(
command_executor=ce,
desired_capabilities={
"browserName": os.environ.get("browser", "firefox"),
"platform": "Linux"
}
)
return driver
except WebDriverException as e:
s = "%s" % e
print("Got exception %s" % s)
print("%s" % dir(s))
if "Empty pool of VM for setup Capabilities" not in s:
raise
time.sleep(5)
if count == 60:
raise Exception("Time out trying to get a browser")
count += 1
评论列表
文章目录