Capture innerText value and write to file

Class library usage, coding and language questions.
Posts: 1
Joined: Wed Nov 12, 2014 6:01 pm

Capture innerText value and write to file

Post by cobbettj » Wed Nov 12, 2014 6:14 pm

HI Guys,

We have a web based application at work that allows us to pull up records for individual customers. I've recorded the automation script that logs in, searches for the customer (passing variable from CSV file) then navigates to the page I need to capture information from. I just don't know how to capture the text I need and write the value to a file, so at the end of the day each customer has a line in a file with the value i need.

I have some basic VB understanding from courses way back in the college days. Any help?

Below is the xPath from Ranorex Spy.

/form[@title~'^Security\ Management\ Help\ ']/element[@class='Frame Tab' and @instance='0']/container/container/dom/body/div[@id='content']/div/iframe/body/div[@id='j_idt5']/div[@id='j_idt5_content']/table/tbody/tr/td[@innertext=' I_NEED_THIS_VALUE']

User avatar
Support Team
Site Admin
Site Admin
Posts: 12169
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Capture innerText value and write to file

Post by Support Team » Thu Nov 13, 2014 4:24 pm

Hi cobbettj,

It is very easy to get the value of an element, in case the text is saved in one of the identified attributes.
If so, just drag'n'drop the corresponding repository item of the live element, which contains the text, to your action table and select Get Value as action and the specific attribute. Then you can select a module variable where the value of that attribute should be saved to. Here is a screenshot how this could look like:
GetValueAction.png (21.03 KiB) Viewed 2116 times

After it was saved to the variable you can bypass the variable to a UserCode action where you can save it to your specific file.
For more information about how to save a string to a file please see the following links: link1 and link2.

I hope this helps :)!