Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Actually you can use a lil bit another approach.</p> <pre><code>String cssSelectorChckbox1= "table[id='ctl00_ContentPlaceHolder1_AddControl1_lstCat']" tbody tr td&gt;input[id='ctl00_ContentPlaceHolder1_Control1_stCat_1']"; String cssSelectorChckboxLabel1="table[id='ctl00_ContentPlaceHolder1_AddControl1_lstCat']" tbody tr td&gt;label[for='ctl00_ContentPlaceHolder1_AddControl1_lstCat_8']"; //then you can use 2 js methods: one for click checkbox, second one for validation label text near chckbox: public void clickOnTheElement(String cssLocator){ JavascriptExecutor js = (JavascriptExecutor) driver; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("var x = $(\'"+cssLocator+"\');"); stringBuilder.append("x.click();"); js.executeScript(stringBuilder.toString()); } public String getTextOfTheElement(String cssLocator) { JavascriptExecutor js = (JavascriptExecutor) driver; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("var x = $(\""+cssLocator+"\");"); stringBuilder.append("return x.text().toString();") ; String res= (String) js.executeScript(stringBuilder.toString()); return res; } //using first method you are able to click on checkbox. clickOnTheElement( cssSelectorChckbox1); //using second method you are able to verify that label near checkbox is correct: String actualCheckboxLabel=getTextOfTheElement(cssSelectorChckboxLabel1); Assert.assertTrue(actualCheckboxLabel.equals("expected text near checkbox")) </code></pre> <p>Hope this somehow helps you)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload