On Mercury Tours web application, when we Select Departing From, Arriving In City and continue on next page, it displayed both City as text element.
For example if we select 'Paris' in Departing from and 'London' in Arriving in drop down the text displayed on next page is like this 'Paris to London'
Using getroproperty("innertext") i am able to get that that particular text.
But i want to verify it for different City selected in Departing from and Arriving In.
i.e. if I parametrize both Departing from and Arriving In drop down I want to verify the text on next page.
Can any one please me guide on this ?
You can do that by using GetROProperty("innertext") itself. But make sure you are not using innertext property for object identification. Try using some other unique properties and if not you will have to parametrize this property or use regular expresstion.
I tried with other only available property html tag= Font. The problem here is that the required text is web element whose name is also same as innertext property value.
I have attached object hierachy for referance.
On parameterize and using regular expression how we can verify the required text on next page ?
In datatable add a column "FlightDetails". In this column add all the text to be verified, e.g. "Frankfurt to Paris".
No parameterize your webelement and checkpoint to take the name/innertext from this column.
All the combinations should be given on different rows. In the begening of For loop mention: DataTable.SetCurrentRow(i).
i is the loop counter.
I have parameterze the Fly From and Fly TO for different City.
It works for first parameter.But when it comes to second parameter it displayed following error message.
The test run cannot continue due to an unrecoverable error.
Cannot identify the object "Frankfurt to New York" (of class WebElement). Verify that this object's properties match an object currently displayed in your application.
Line (8):
Code:
"Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebElement("Frankfurt to New York").Check CheckPoint("Frankfurt to New York")".
The problem here is that the webelement("Frankfurt to New York"),changes as Fly From and Fly To get chnaged.
Will you please guide me how to use regular expression for this WebElement("Frankfurt to New York") ?
I am able to solve it partialy. I used Standard checkpoint to get the required text.
I used following For loop.
Code:
for i=1 to Datatable.rowcount
set Datatable.currentrow
msgbox Datatable.value("Datatable column Name",dtGlobalSheet)
Next
Here i am getting the expected value. I have set the Run properties to Run for all iteration.
But here it runs 9 times.
On first iteration it displayed the expected value. then for second and third the msgbox is blank.
Again for fourth iteration it displayed the expected value of Second parameter i add for Fly From and Fly To. Fifth, sixth are again blank. so on...
Is there anything wrong with For....Next loop ?
Thanks very much Manish, for your prompt reply. I will try on it.
One Question related to this thread, what is regular expression pattern to match ' Paris to London'. Here only 'to' remains constant.
The Regular Expression will be:
.* to .*
But this wont be able to check if the values are getting populated as per your selection on previous page rather it will consider any text before and after "to".