Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x Python Selenium在同一测试用例中多次使用with ActionChains执行双击()_Python 3.x_Selenium_Selenium Webdriver - Fatal编程技术网

Python 3.x Python Selenium在同一测试用例中多次使用with ActionChains执行双击()

Python 3.x Python Selenium在同一测试用例中多次使用with ActionChains执行双击(),python-3.x,selenium,selenium-webdriver,Python 3.x,Selenium,Selenium Webdriver,当我在我的项目中创建一个测试套件时,我需要在同一页面(和同一测试用例)的不同web元素上执行5次双击()。在执行第一次双击后,将在同一web元素(第一个)上执行第二次双击()。在执行第一次双击()后,我尝试使用reset_actions(),但它也不起作用。我使用selenium 3.8.1版本。下面是我的示例代码: def setUp(self): self.web = Webdriver() self.act = ActionChains(self.web) def Tes

当我在我的项目中创建一个测试套件时,我需要在同一页面(和同一测试用例)的不同web元素上执行5次双击()。在执行第一次双击后,将在同一web元素(第一个)上执行第二次双击()。在执行第一次双击()后,我尝试使用reset_actions(),但它也不起作用。我使用selenium 3.8.1版本。下面是我的示例代码:

def setUp(self):
    self.web = Webdriver()
    self.act = ActionChains(self.web)

def TestCase(self):
    self.web.switch_to.default_content()
    self.web.switch_to_frame('frame_ID')
    self.act.double_click(self.web.find_element_by_link_text("ID-1")).perform()
    ActionChains(self.web).reset_actions()

    # Check something and close opened pop-up

    self.act.double_click(self.web.find_element_by_link_text("ID-2")).perform()
    ActionChains(self.web).reset_actions()

    # Check something and close opened pop-up

    self.act.double_click(self.web.find_element_by_link_text("ID-3")).perform()
    ActionChains(self.web).reset_actions()

    # Check something and close opened pop-up

    self.act.double_click(self.web.find_element_by_link_text("ID-4")).perform()
    ActionChains(self.web).reset_actions()

    # Check something and close opened pop-up

    self.act.double_click(self.web.find_element_by_link_text("ID-5")).perform()
    ActionChains(self.web).reset_actions()

    # Check something and close opened pop-up

    def tearDown(self):
    self.web.quit()

有没有办法在同一个测试用例中多次使用ActionChains双击()的方法?

您是否收到任何错误/异常?您说过双击后关闭弹出窗口,您记得切换回父窗口吗?不,我没有收到任何异常或错误。在每次双击()时,它都会打开相同的弹出窗口,我的意思是每次它双击()到“ID-1”。顺便说一句,所有网页元素都位于同一个框架中。用网页的HTML更新问题我不能这样做,因为这个项目属于我工作的公司,他们对此有严格的规定。但我可以保证问题不在于框架或窗户。每次(在关闭弹出窗口后)我都试图切换回主框架,但仍然无法工作。