I need to select elements that don't have explicit IDs, and have figured out that xpath is a dead end. Newer versions of our application are built with IDs, but I still need to test legacy versions that are a mix of old and new elements.
We use a Java bin that uses SmartClientWebBrowser and SeleneseTestCaseParser to read html test case files.
The two elements in question are the text fields used for login - they are the only two input fields on the page:
<td style="vertical-align: top;" align="left"><input class="loginTextField" style="width: 300px;" id="" type="text"></td>
<td style="vertical-align: top;" align="left"><input class="loginTextField" style="width: 300px;" type="password"></td>
When I use the Selenium IDE it offers //input[@id=''] as the selection syntax, which of course doesn't work when I pass it to the SC class (more detailed queries also fail: //input[@class='loginTextField' and @type='text']). When I right click on other elements that have IDs, the proper sclocator syntax is shown and I can interact with them as expected.
How do I select these elements?
I've read these two:
https://www.smartclient.com/smartgwt...gSelenium.html
https://www.smartclient.com/smartgwt.../AutoTest.html
And can see this example:
//DynamicForm[ID="autoTestForm"]/item[name=textField||title=textField||value=test||index=0||Class=TextItem]/element
But don't understand enough to apply this to my situation (this is my first foray into automated testing). Appreciate any insight you can offer.
edit: the <td> I'm trying to select is nested inside a div that has an ID of "isc_C" - it appears to be a WidgetCanvas wrapping plain html. Structure is div->div->tbody->tr and finally the two td that I want. Can paste the block if it will help. I thought maybe I could select the parent item using the id/class/index, then 'walk' to my desired elements, but this syntax is beyond me.
We use a Java bin that uses SmartClientWebBrowser and SeleneseTestCaseParser to read html test case files.
The two elements in question are the text fields used for login - they are the only two input fields on the page:
<td style="vertical-align: top;" align="left"><input class="loginTextField" style="width: 300px;" id="" type="text"></td>
<td style="vertical-align: top;" align="left"><input class="loginTextField" style="width: 300px;" type="password"></td>
When I use the Selenium IDE it offers //input[@id=''] as the selection syntax, which of course doesn't work when I pass it to the SC class (more detailed queries also fail: //input[@class='loginTextField' and @type='text']). When I right click on other elements that have IDs, the proper sclocator syntax is shown and I can interact with them as expected.
How do I select these elements?
I've read these two:
https://www.smartclient.com/smartgwt...gSelenium.html
https://www.smartclient.com/smartgwt.../AutoTest.html
And can see this example:
//DynamicForm[ID="autoTestForm"]/item[name=textField||title=textField||value=test||index=0||Class=TextItem]/element
But don't understand enough to apply this to my situation (this is my first foray into automated testing). Appreciate any insight you can offer.
edit: the <td> I'm trying to select is nested inside a div that has an ID of "isc_C" - it appears to be a WidgetCanvas wrapping plain html. Structure is div->div->tbody->tr and finally the two td that I want. Can paste the block if it will help. I thought maybe I could select the parent item using the id/class/index, then 'walk' to my desired elements, but this syntax is beyond me.
Comment