0

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?

4
  • Could it be that this is not the only iframe in page? Try to switch it by id instead of index. Commented Aug 1, 2017 at 15:49
  • I tried IWebElement leftPane = driverChrome.FindElement(By.XPath("//html//body//iframe")); driverChrome.SwitchTo().Frame(leftPane); but get the same result. I can however, execute the code in the Browser Console correctly: document.getElementsByClassName("overall-options")[0].click() Commented Aug 1, 2017 at 16:01
  • So... Does it work if you try driverChrome.SwitchTo().Frame("iFrameResizer0");? Commented Aug 1, 2017 at 16:17
  • No it does not. Commented Aug 1, 2017 at 17:23

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.