简体   繁体   English

无法使用Selenium C#选择元素

[英]Unable to select element using Selenium C#

样例代码

I am unable to find the element either by XPath, CssSelector, ClassName, etc...for the highlighted text (which is a button). 我无法通过XPath,CssSelector,ClassName等为突出显示的文本(这是一个按钮)找到元素。 Have the following code: 具有以下代码:

driverChrome.SwitchTo().DefaultContent();
driverChrome.SwitchTo().Frame(0);
IWebElement optionsGear = driverChrome.FindElement(By.CssSelector("html body div#app.d2l-typography div#root-wrapper div.main-wrapper div.root div.main div.navigation-container div.nav-header div.options-header div.overall-options-container div.options-dropdown button.button.overall-options"));
optionsGear.Click();

Any suggestions or ideas? 有什么建议或想法吗?

发现进行隐式等待可以解决问题:driverChrome.Manage()。Timeouts()。ImplicitWait = TimeSpan.FromSeconds(10);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM