Choose search result?

power-user
aa_training_s
#1

So I’m having some troubles figuring out how to make the rpae to understand which search result to pick from Amazon.com.

If I search for “v-moda crossfade m100”, several correct results appear. How do I make the rpae understand that it can pick either of these? An xpath to the item didn’t work.

#2

@ErikW do you need to save all results, or just one of them?

#3

rpae only needs to pick one of the results and click it. Once inside it needs to fetch price and seller.

#4

Any ideas? Still stuck on this.

#5

Try clicking on Xpath //*[@id="result_0"]//a/h2 on the result page - it should open the page of the 1st search result. Then you can save data from that page using Web element actions.

#6

Thanks this worked. I find the Xpaths (chrome) to be quite frustrating to find. When trying to go back to the site I can’t find the one you found that ends with //a/h2.

Same problem with the “condition, New, Used” option to the left. I can find a million Xpaths related to clicking “New”, but none of them actually generate a click!

Any advice on this?

#7

In a lot of cases, you need to create an XPath manually.
Have you read our XPath guide in the Knowledge Base?

https://kb.workfusion.com/display/RPAe/XPath+Guide

It can be a bit hard to understand for newbie, but it explains how to create XPaths, and it has several examples.

#8

Yeah I’ve read it, but yeah it’s a bit too short and technical. I have a hard time applying it to my context. For example amazons “new” button in Chrome inspector is as follows:

//*[@id=“leftNavContainer”]/ul[9]/div/li[1]/span/a/span

But doesn’t work. Any idea how to adapt it to a proper “clickable” Xpath?

#9

Try this: //*[@id=“leftNavContainer”]//span[text()='New'] or //*[@id="leftNav"]//span[text()='New']

it will look for a span element in the Left navigation panel with the text New. regardless of its position.

#10

Thanks for the effort, sadly it doesn’t work. Maybe something else is wrong then. Here’s what I have:

A loop repeats while newprodicts = false. Then I have an exception handling, try to complete click New and change constant variable to newproducts = true. if an exception, scroll down.

But it never finds the new button with Xpath. It did work sometimes when I used it for finding a picture of the text, but it was unreliable.

#11

Do you need to click the link New on the filters panel?

I tried it with the second Xpath, and it worked.

image

#12

Yeah exactly, tried it again and still having problems. Please see below, what am I missing?

#13

For a test, try removing the scroll and the loop, and see with which error the bot fails?

When you click on an Xpath, the bot should find the element even if it is not on the visible part of the screen.

Also, when you check this Xpath in dev tools in Chrome, does it find a match?

#14

Hm yes if I remove the loop it works. Yeah, the Xpath is found in the inspector.

So the Xpath wasn’t the problem… don’t get why the loop fails though.

1 Like
#15

No wait, it still doesn’t work for some reason. Strange. I tried a simple test and it fails:

#16

Yeah, it is weird. Did it keep scrolling down the page when you had the exception handling?

#17

Yeah it just keeps scrolling. But in case you missed my latest answer, I think maybe there’s something with the xpath anyway. hmm.

#18

You’re right, I didn’t see your last post.
What error does the bot show?

#19

This is crazy, I just started RPA Express, and without touching anything played the exact same recording as yesterday and now suddenly it works.

Then I changed back to the loop, tried it and had an issue, then changed it back to the simple version and suddenly it doesn’t work. Then I ran it again and it worked, and then again and it didn’t work.

Very strange.

Here’s the error message:

#20

Perhaps, you need to set a bigger timeout for the mouse click.

Can you click on Details>> and share the details of the error? The reason for the error should be in the text after Caused by: