I have a problem for which I am having trouble finding a solution.

Problem :

  1. I need to navigate to a webpage and check if three checkboxes are selected. If not, I’d like to select them (if only one is selected, I’d like to select the other two and etc).

  2. If they are already selected, then exit the page.

I have:

Declared the elements with xpath:

IWebElement aaa = driver.findElement....

IWebElement bbb = driver.findElement....

IWebElement ccc = driver.findElement....

I would like to wrap the three elements above into a variable perhaps to do something like this:

var threeCheckboxes = aaa, bbb, ccc

So I could get a potential statement like:

if (threeCheckboxes.Selected)

{ select the three boxes(etc)

Any ideas?

Source link https://sqa.stackexchange.com/questions/35522/c--how-to--a-conditional-statement-with--elements-xpaths


Please enter your comment!
Please enter your name here