每次新迭代都会出现新的浏览器窗口

时间:2017-02-09 12:58:35

标签: selenium selenium-webdriver

当我尝试这段代码时,我需要打开每个新的迭代,新的浏览器窗口:

class GoogleTest(unittest.TestCase):

    def setUp(self):
        self.browser = webdriver.Chrome('/home/andrew/Downloads/chromedriver')
        self.wait = WebDriverWait(self.browser, 20)
        self.browser.implicitly_wait(30)

    def test_01_goole(self):
        for i in range(3):
            browser = self.browser
            browser.get('http://www.google.com')
            browser.close()

我收到:

WebDriverException: Message: no such session

0 个答案:

没有答案