HTLM source:
<ul id="dropdownSelectRole" class="dropdown-menu" role="menu">
<li><a href="#"></a></li>
<li><a href="#">Admin</a></li>
<li><a href="#">aaaa</a></li>
<li><a href="#">abcd</a></li>
<li><a href="#">admin</a></li>
</ul>
JS code:
'should verify counter on active tab': function (browser) {
//Given
var welcome = browser.page.welcome();
var users = browser.page.users();
//When
welcome.click('@usersButton');
var count = users.size.element('@table');
//Then
users.expect.element('@activeTab').contains.text(count);
},
My code doesn't work cause still getting errors like TypeError: Cannot read property 'element' of undefined or TypeError: undefined is not a function.
What i need is to take the number of elements from the HTML table and put it to some string in order to assert later on with value on a tab. Simple test that number displayed in a tab is relevant to number of records.
I am using page object (users and welcome are pseudo-classes with listed elements selectors, @table is selector of the table with elements, @activeTab is selector of the tab which contain number of records).
To make question simply I need in JS something like this JAVA:
int count = getDriver().findElements(By.xpath("//*@id=\"content\"]/div/div/table/tbody/tr")).size();
String count1 = Integer.toString(count);