Baljeet Bilkhu
Baljeet Bilkhu

Reputation: 103

Unable to select element using Selenium C#

Sample code

I am unable to find the element either by XPath, CssSelector, ClassName, etc...for the highlighted text (which is a button). 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?

Upvotes: 0

Views: 340

Answers (1)

Baljeet Bilkhu
Baljeet Bilkhu

Reputation: 103

Found that putting in an implicit wait resolved the problem: driverChrome.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);

Upvotes: 1

Related Questions