How to get the cell text?

Ask general questions here.
usov
Posts: 17
Joined: Mon Dec 04, 2017 11:13 am

How to get the cell text?

Post by usov » Tue Dec 12, 2017 9:54 am

Hello.
How to get the cell text?
Ramorex 7.2.1 ,Windows 7

rxpath = "/form[@name='LeoMainWindow']//container[@name='qt_tabwidget_stackedwidget']/?/?/container[@name='WorkspaceFrame']/container[@type='QScrollArea']/element/table[2]/row[@index='3']/cell[@columnindex='1']"

Element.GetAttributeValueText("Text") return null

If this is useful, then I tried to track the item through Inspect.exe and received LegacyIAccessible.Name ="C" and Name ="C"
Attachments
2.jpg
screen program
2.jpg (210.56 KiB) Viewed 784 times
2017-12-12 11_09_26-Inspect  (HWND_ 0x001B0950).jpg
screen inspect
2017-12-12 11_09_26-Inspect (HWND_ 0x001B0950).jpg (233.37 KiB) Viewed 784 times
1.rxsnp
(383.2 KiB) Downloaded 19 times

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

Re: How to get the cell text?

Post by odklizec » Wed Dec 13, 2017 8:54 am

Hi,

Try to enable Use QT legacy automation mode in Ranorex Settings...
QTSettings.png
QTSettings.png (15.61 KiB) Viewed 775 times
If this does not help, then it's most probably a bug in Ranorex QT plugin, since Inspect recognizes the text properly.
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

usov
Posts: 17
Joined: Mon Dec 04, 2017 11:13 am

Re: How to get the cell text?

Post by usov » Fri Dec 15, 2017 1:38 pm

Thank you very much!That helped

usov
Posts: 17
Joined: Mon Dec 04, 2017 11:13 am

Re: How to get the cell text?

Post by usov » Fri Dec 15, 2017 2:31 pm

There are new problems...When "Use QT Legacy automation mode"=true ,then rxpath completely changes...

"Use QT Legacy automation mode"=true :

Code: Select all

rxpath='/form[@name='LeoMainWindow']//container[@name='qt_tabwidget_stackedwidget']/?/?/container[@name='WorkspaceFrame']/container[@type='QScrollArea']/element/table[2]/row[@index='3']/cell[@columnindex='1']'
"Use QT Legacy automation mode"=false :

Code: Select all

rxpath='/form[@title~'^Leonardo']/container[@accessiblerole='Client']/?/?/container[@accessiblerole='Pane']/?/?/separator/container[2]/?/?/container/table[2]/cell[@accessiblename='C']'
Now no properties ColumnIndex and RowIndex and others.=( And this means that you need to completely change all rxpath in the project =(

Also Ranorex Spy stopped finding windows in the application.And this is not allowed at all
Attachments
true.jpg
true.jpg (122.26 KiB) Viewed 761 times
false.jpg
false.jpg (155.99 KiB) Viewed 761 times

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

Re: How to get the cell text?

Post by odklizec » Fri Dec 15, 2017 3:09 pm

Too bad. I believe that the xpath ending with "/row[@index='3']/cell[@columnindex='1']'" is in fact the one taken with Use QT Legacy automation mode=false? At least first screenshot confirms it ;)

Well, the question is if it's something to fix in Ranorex? Considering the fact, that Inspect shows the content of cell both in Name and LegacyIAccessible.Name, then it looks like a bug in Ranorex?

BTW, do I understand it right that it worked OK with some previous version of Ranorex?
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

usov
Posts: 17
Joined: Mon Dec 04, 2017 11:13 am

Re: How to get the cell text?

Post by usov » Mon Dec 18, 2017 7:06 am

""/row[@index='3']/cell[@columnindex='1']'" is in fact the one taken with Use QT Legacy automation mode=false? At least first screenshot confirms it ;) " - Yes of course :)

"By the way, do I understand correctly that it worked fine with the previous version of Ranorex?" - I think that this did not work in the previous version either.

usov
Posts: 17
Joined: Mon Dec 04, 2017 11:13 am

Re: How to get the cell text?

Post by usov » Mon Feb 12, 2018 7:11 am

It seems the Text property is not displayed in Ranorex if a cell's DispalyRole returns a non-standard QVariant with UserType in it. According to our developers, the table uses default QStyledItemDelegate with displayText() method that calls QVariant::toString() converter. The convertor has been explicitly registred by calling QMetaType::registerConverter<CustomMetaType, QString>. AccessibleName property in legacy mode looks good for such custom types, but not the Text one. It's only displayed for standard QVariants (e.g. QString).