mardi 3 janvier 2017

Angular2 - How can I tick a checkbox using Selenium webdriver

I have a web application which is written in Angular2. On the web page I have a checkbox which has been implemented as follows:

<label ng-reflect-html-for="required" for="required">Required</label>
::before
"Required"
</label>

Once the checkbox is ticked the code looks like:

<label ng-reflect-html-for="required" for="required">Required</label>
::before
"Required"
::after
</label>

I am trying to write automation tests for this, so that I can tick the checkbox if its unticked, but I can't seem to make it work with the following code:

var findControl = (NgWebElement)webDriverWait.Until(ExpectedConditions.ElementIsVisible((By.CssSelector(string.Format("[data-e2e='{0}']", controlName)))));
findControl.Click();

What am I doing wrong? Is there a way to make this work?




Aucun commentaire:

Enregistrer un commentaire