How to increment a value in HTML every time a selenium test case is ran -
i testing registration page website, beginner in html scrip. struggling automate script register there validation on email address unique. can tell me how increment value in code below.
<tr> <td>type</td> <td>id=maincontent_email</td> <td>validtestemail@test.com</td>
you can use selenium-webdriver execute script can change text of 1 of cells.
((ijavascriptexecutor)driver).executescript("var cellvalue = $('td1').text(); cellvalue = cellvalue + 1; $('td2').text(cellvalue)");
something similar javascript in above example.
another way format string within selenium running code , increment way:
string scripttorun = string.format("var cellvalue = {0}; cellvalue = cellvalue + 1; $('td2').text(cellvalue)", incrementingvalue); ((ijavascriptexecutor)driver).executescript(scripttorun);
the script selectors above need improved , match html.
Comments
Post a Comment