[Tips & Tricks] Using XPath


#1

Hi folks,

as we received tons of question about how to use XPath expressions in RPA Express recordings, the next topic in RPA Express Tips & Tricks is the XPath.

For more details refer to this topic in RPA Express Knowledge Base

Stay tuned for future updates!


Table variable example
How can we get X-PATH from already open browser?
Unable to get webelement using Xpath from Div
Set value to a combo box item
RPA Recorder XPath issue
How to extract twitter data from web any one have idea
Is there any way to capture all similar elements based on XPath
#2

@maninder_sodhi, @Qi_Zhou_Singtel, @chau_nguyen, @Quy_Huynh_Thanh, @pmisiewicz, @timriewe, @Humberto_Zuniga, @Pierre_Bernier3, @Lasitha_Wijenayake, @Thiru_Gunturu, @Jens_Jespersen5, @sharad_kumar, @joreian, @jdoering, @vertex, @haider_raza, @stephane_wagner, @gerhardus_meyer, @tilak_patil, @Guillermo_Lasso5

Please kindly let us know your opinion about the subject topic.

Thank you in advance.


#3

Hi all,
I have one concern like in selenium xpath can take list of data but here if i want to take xpath of some table structure but unfortunately xpath can take only string type of data…may be i am not aware how to do…Can anybody give me some idea.
Thanks


#4

please give us more details


#5

Hi @azinchuk,
I have one table in this tutorial website
https://www.w3schools.com/html/html_tables.asp
I want to select this table data by using xpath but in recorder xpath takes only string type of data,i did with image based but may be always it is not a good solution if something changed script will fail…By using xpath can we take table type data.
Thanks


#6

Hi @amashentsev
Any additonal resource for getting informaton is helpful. I havent used webactions yet in my processes but when I do you can be sure I check your tips and tricks first.
:+1:


#7

No problem - just use this XPath:

//table[@id='customers']

and save result to a List variable:

The result will look like this:

Company Contact Country\nAlfreds Futterkiste Maria Anders Germany\nCentro comercial Moctezuma Francisco Chang Mexico\nErnst Handel Roland Mendel Austria\nIsland Trading Helen Bennett UK\nLaughing Bacchus Winecellars Yoshi Tannamuri Canada\nMagazzini Alimentari Riuniti Giovanni Rovelli Italy

Afterwards, you can use the Text actions to split it: https://kb.workfusion.com/display/RPAe/Text#Text-SplitStringSplitString

OR you can use this XPath:

//table[@id='customers']//td

and the result will look like a list:

["“Alfreds Futterkiste”","“Maria Anders”","“Germany”","“Centro comercial Moctezuma”","“Francisco Chang”","“Mexico”","“Ernst Handel”","“Roland Mendel”","“Austria”","“Island Trading”","“Helen Bennett”","“UK”","“Laughing Bacchus Winecellars”","“Yoshi Tannamuri”","“Canada”","“Magazzini Alimentari Riuniti”","“Giovanni Rovelli”","“Italy”"]


#8

any info on Xpath is highly appreciated, I am also having a issue where one has to hover over a button for it to produce a drop down menu, then only does xpath work to click on the item in the list.

Also sometimes xpath I copy does not work although the button is highlighted when I select it on the webpage(using firefox mostly)


#9

@azinchuk means there is no use of table2clipboard action i…With this without image based we can take anything i guess


#10

we are planning to fix the Table2Clipboard plugin issue


#11

Similar to Tim and others, have not used the Webapps actions. Most interactions are Excel, Outlook and ERP solutions.


#12

Hello guys… I don’t know if I have to share my problem here or create a new topic… anyway:

I have a website where I need to get the value of one atribute… How can I do that?

This is the source code:

And I want to get the value “38526626”

I’m using this xpath //*[@id=“id0”]/@value

And this gives me an error…

How can I do this?


#13

Hi @joreian,
May be till now this feature is not avaliable
you can check in below thread.
Limitations on the web element action
Thanks


#14

@joreian,

Your Xpath should be:
//*[@id=“id0”]

And you need to check the Use element attribute option and enter value in it:

see - https://kb.workfusion.com/display/RPAe/Web#Web-GetValue


#15

@sharad_kumar - those limitations do not exist since 1.1.5 version


#16

@azinchuk Thanks for information.


#17

Wow… @azinchuk Thanks!!! I was trying to make a scritp in python to solve that but i had the problem that i have to log in that website… and the information that I wanted is inside of an iframe, this feature solve everything.

Thank you !!!


#18

Hi @azinchuk ,
In first approach how we can identify what is table header and data ans how we can split when we are storing all the values in list as far as i know we can split string only and how we can remove \n problem because it is throwing exception with open spreadsheet set cell value,may be i dont know how to do,please elaborate more,because table2clipboard action works perfactly as i want but throgh xpath i want to store as it is table data in excel.
Thanks