Rah*_*dha 18 c# automated-tests selenium-webdriver
如何用鼠标悬停/使用selenium webdriver查看隐藏的菜单而不执行任何鼠标点击?
我正在测试的网站上有一个隐藏的菜单只会出现在鼠标悬停/上方.注意:如果执行了任何点击,页面将被重定向,因此请建议无需点击的解决方案
我试过了:
IWebDriver driver = new FirefoxDriver()
Actions builder = new Actions(driver)
builder.MoveToElement(driver.FindElement(By.Id("Content_AdvertiserMenu1_LeadsBtn")))
.Click().Build().Perform();
Run Code Online (Sandbox Code Playgroud)
ton*_*ung 39
试试这个?
// this makes sure the element is visible before you try to do anything
// for slow loading pages
WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
var element = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(elementId)));
Actions action = new Actions(driver);
action.MoveToElement(element).Perform();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
43915 次 |
| 最近记录: |