将鼠标悬停在菜单上,然后点击带有selenium的子菜单c# [英] Hover on menu and click on submenu with selenium c#
问题描述
Hello All,
我正在用c#编写脚本,
我写了代码对于菜单悬停和子菜单单击如下所示,
操作操作=新操作(驱动程序);
IWebElement menuHoverLink = driver.FindElement (id,idofelement);
actions.MoveToElement(menuHoverLink).Build()。Perform();
通过submenucss = By.CssSelector(cssselectorofelement);
WebDriverWait wait1 = new WebDriverWait(driver,TimeSpan.FromSeconds(20)) ;
wait1.Until(ExpectedConditions.ElementExists(submenucss));
IWebElement子菜单= driver.FindElement(submenucss);
子菜单。点击();
但它并不适用于所有浏览器。
我希望代码有效全部或至少(chrome,firefox,IE)。
if anyb然后请分享你的知识。
问候,
Kedar Borkar。
Hello All,
I am writing scripts in c#,
I have written the code for menu hover and sub menu click just as below,
Actions actions = new Actions(driver);
IWebElement menuHoverLink = driver.FindElement("id", "idofelement");
actions.MoveToElement(menuHoverLink).Build().Perform();
By submenucss = By.CssSelector("cssselectorofelement");
WebDriverWait wait1 = new WebDriverWait(driver, TimeSpan.FromSeconds(20));
wait1.Until(ExpectedConditions.ElementExists(submenucss));
IWebElement submenu = driver.FindElement(submenucss);
submenu.Click();
But it is not working for all browsers.
I want the code that works in all or atleast (chrome,firefox,IE).
If anybody have the idea then please share your knowledge.
Regards,
Kedar Borkar.
这篇关于将鼠标悬停在菜单上,然后点击带有selenium的子菜单c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!