How to read out values from textbox

Ask general questions here.
mapa
Posts: 22
Joined: Tue Jun 06, 2017 7:29 am

How to read out values from textbox

Post by mapa » Wed Jun 21, 2017 12:31 pm

Hey guys,

i need to read out the text which is seen in the screenshot and safe this in a variable.
Is there a way how i can do that ?

this is the xpath to the element:
.//container[@name='OptionPane.realBody']/container[@name='OptionPane.body']/text[@caption~'^A\ job\ with\ the\ ID\ ''1948''\ ']

regards
patrick
Attachments
2017-06-21_13h25_01.png
2017-06-21_13h25_01.png (8.2 KiB) Viewed 731 times

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3945
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: How to read out values from textbox

Post by odklizec » Wed Jun 21, 2017 12:49 pm

Hi,

Please upload a Ranorex snapshot (not screenshot) of the mentioned message box.

Basically, it should be enough to use GetValue action for element stored in repo with this xpath:

Code: Select all

.//container[@name='OptionPane.realBody']/container[@name='OptionPane.body']/text
Without seeing the snapshot, it's hard to tell if the xpath is unique. So try the above xpath, if it uniquely identifies the text element.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Vaughan.Douglas
Posts: 250
Joined: Tue Mar 24, 2015 5:05 pm
Location: Des Moines, Iowa, USA

Re: How to read out values from textbox

Post by Vaughan.Douglas » Wed Jun 21, 2017 2:02 pm

Before we get too far into this you should clarify what you're trying to accomplish. Are you trying to validate that a specific text exists or are you trying to identify an object based on specific text.

If you're trying to validate the specific text, you should NOT use that specific text as an attribute in the RxPath. Otherwise rather than getting a validation failure you'll get an object identification failure.

If you're just trying to capture the text for comparison later, I still wouldn't use the specific text in the RxPath because you may run into that same object ID failure again. If you provide a snapshot, we can assist in developing an appropriate RxPath to get you what you need.

Second the "getValue" action as odklizec mentions is appropriate. You'll want to create a module variable to store the value and you'll need to create a parameter in your test suite at some level in order to pass it on to other modules.

Please please please don't just capture the text and print it off in the report. the purpose of automation is defeated when someone has to physically review a report to validate something that could be asserted in text. I see novice users in my organization do this all the time and it drives me crazy.
Doug Vaughan

mapa
Posts: 22
Joined: Tue Jun 06, 2017 7:29 am

Re: How to read out values from textbox

Post by mapa » Thu Jun 22, 2017 8:52 am

i could solve the problem via the getValue method.
Thanks for your advice