Description
While creating a Web Testcase, populating a field may require an additional step to enable a button or trigger a state change.
Scenarios where this issue occurs:
- With WWE, the log in button is disabled until a username and password have been entered. With Cyara setting the username and password field with SetValue, the log in button remains disabled.
- After setting the username and password field with SetValue and clicking log in, log in is unsuccessful and/or customer receives an error message stating that they haven't entered a username/password.
- When providing a value in a search field, a drop down menu does not appear or cannot click search.
Solution
First, identify what should happen when the field is populated outside of Cyara.
- Open web page in Google Chrome
- Click the three vertical dots in the upper right corner on the toolbar
- In the drop down menu, go More tools ---> Developer tools
- With the Elements window open, click on the Select Tool
- Using the Select Tool, click on the desired field to view that section of the code
- While typing in the field, watch what occurs to the code in the Elements window
Second, identify what is happening when the field is populated in Cyara.
- Open Developer tools in Google Chrome
- With the Elements window open, use the select tool to navigate to the correct field
- Using Console, populate the field using document.querySelector('#NAME').value = "VALUE". Pay attention to what occurs to the code when the field is populated
Third, compare what is supposed to be occurring when an input is given versus what is actually occurring when Cyara populates it.
If the button should become enabled after inputting a value in the field, use the following:
JavaScript ("document.querySelector('#NAME').disabled=false");
If a state change should occur, such as empty to not-empty, use the following:
JavaScript ("$('#NAME').triggerHandler('change')");
Note: The scripts above have to be modified (i.e #NAME or VALUE) depending on the web page code.
Comments
0 comments
Please sign in to leave a comment.