Selenium 2.0b3 IE WebDriver, Click not firing

后端 未结 18 1915
我寻月下人不归
我寻月下人不归 2020-11-29 02:33

When using the IE driver with IE9, occasionally the Click method will only select a button, it wont do the action of the Click(). Note this only happens occasionally, so i d

18条回答
  •  既然无缘
    2020-11-29 02:47

    I have found the same thing on Internet Explorer 8 when attempting to click links using .Click() - even though I can see Selenium clicking on the link. From my experience it appears that if the browser does not have focus then the initial click doesn't work.

    A workaround to this is to send a .Click() to another element on the page, so that the browser gets the focus, before attempting to click the link, e.g. it's parent:

    Driver.FindElement(By.Id("Logout")).FindElement(By.XPath("..")).Click();
    Driver.FindElement(By.Id("Logout")).Click();
    

提交回复
热议问题