Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to get text of weblement
#1
Solved: 10 Years, 9 Months ago
Hi All,

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 ?

Thanks in advance

Sudhir
Reply
#2
Solved: 10 Years, 9 Months ago
Hi Sudhir,

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.
Reply
#3
Solved: 10 Years, 9 Months ago
Hi Manish,

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 ?

Thanks in advance.


Attached Files Image(s)
   
Reply
#4
Solved: 10 Years, 9 Months ago
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.
Reply
#5
Solved: 10 Years, 9 Months ago
Hi Manish,

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") ?
Reply
#6
Solved: 10 Years, 9 Months ago
Hi Sudhir,

You will have to parameterize both, the WebElement as well as the Checkpoint from datatable.
Reply
#7
Solved: 10 Years, 9 Months ago
Hi Manish,

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 ?
Reply
#8
Solved: 10 Years, 9 Months ago
Hi Sudhir,

Change the run Properties to Run one Iteration Only.
Now update For loop as:
Code:
For i = 1 To DataTable.GetRowCount
   DataTable.SetCurrentRow(i)
   MsgBox DataTable.Value("DataTable Column Name", dtGlobalSheet)
Next
Reply
#9
Solved: 10 Years, 9 Months ago
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.
Reply
#10
Solved: 10 Years, 9 Months ago
Hi Sudhir,

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".
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to Validate Text filed is blank after clicking on the Text box balak89 3 4,543 09-13-2015, 12:06 AM
Last Post: ADITI1992
  I am trying to extract text from a webelement but it is generating blank text scenari excellentpawan 2 4,288 08-13-2013, 08:37 PM
Last Post: excellentpawan
  how to find a particular text in a text string pjavvaru 3 16,630 06-04-2010, 08:49 PM
Last Post: jsknight1969
  Retrieve text from Text Checkpoint Amit Singh Chauhan 1 2,304 08-20-2009, 07:15 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)