I’m looking for a way to capture the information from the website to use it for the next case. For example, in my first test case there is a button for generating a number I press that button the number is populated in the text box. How can I get the number from the text box or save that number in order to use that number for the 2nd case in the same test suite.
Capture generated data from the web
Russ_Thomas
#3
Test Case 1
//Modify a global variable
GlobalVariable.myNumber = getText(...) // e.g. "6"
Test Case 2 (3, 4, 5 etc)
WebUI.comment("My number = " + GlobalVariable.myNumber) // "My number = 6"
helpdesk
#4
Once the number is in the textbox, you should be able to retrieve the number by:
GlobalVariable.gButtonNum = WebUI.getAttribute(to_textbox, ‘value’)
And then you can use the GlobalVariable reference across the Test Cases within a Test Suite. Just a note that the value of the text box will likely be a String reference and not an Integer. Although you are saying it is a number in the text box, it will still likely be a String, but if needed, you can use conversion to get the Integer back, such as:
String number = "10";
int result = Integer.parseInt(number);