Reputation: 1633
I've made a number of tests using Selenium
. I was curious if I'm nesting correctly. I'm not sure if there is a better way and if there is I would be happy to hear it.
At the moment I open a PowerPoint session in my start up using the WinApp
Driver. Then when nesting I do the following. Here I'm finding an element called Linking. A child of Linking in the tree of elements is Update and so on.
var linking = session.FindElementByName("Linking");
var update = linking.FindElementByName("Update");// within the linking element there is an update button
update.Click();
session.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
var all =update.FindElementByName("All");// within the update element there is a dropdown menu with an "All" button
session.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
all.Click();
Upvotes: 0
Views: 271
Reputation: 1991
In a comment, you mentioned the issue with the code was that all
wasn't clickable unless you put in a sleep.
Use an explicit wait. Something like:
new WebDriverWait(session, TimeSpan.FromSeconds(10))
.Until(ExpectedConditions.ElementToBeClickable(update.FindElementByName("All"))
Things might be a bit different for the WinApp Driver, but that's the basic idea.
Upvotes: 1