Jump to content
UBot Underground

Using $Elementoffset With Exbrowser?


Recommended Posts

Hi,

 

I'm using exbrowser but also using the recording function in uBot to help me figure out the code.

The goal is to click an element. The recording feature records this and I'm trying to figure out how to translate this into ExBrowser since the existing code all uses exbrowser.

 

click($element offset(<class="button">,0),"Left Click","No")

 

The problem is uBot won't let me drop $element offset into a click function of exbrowser.

 

I'm also trying to find some instructions that explain $element offset. I'm reading this http://wiki.ubotstudio.com/wiki/Element_Offsetand I understand it's used when there are multiple elements with the same name so it doesn't know which one. So I guess in the click command it is saying to "click the first button".

 

But using the click command doesn't work and using the xPath equivalent in Exbrowser also does not work, I think it needs an offset.  Thanks!

Link to post
Share on other sites

ExBrowser uses xpath so here is an example of how to scrape something in Ubot and then use Xpath to scrape the same thing:

navigate("http://www.ubotstudio.com/resources","Wait")
wait(3)
set(#ubot,$trim($scrape attribute($element offset(<tagname="h3">,3),"innertext")),"Global")
set(#xpath,$trim($plugin function("ExBrowser.dll", "$ExBrowser Generic Xpath Parser", $document text, "(//h3)[4]", "innertext", "")),"Global")

Basically write your xpath, when you need an offset then surround the xpath with parenthesis - these things ( ) - and then in brackets put your offset number but remember that while Ubot offsets start counting at 0 xpath offsets start at 1 which is why in Ubot the offset is a 3 but in the xpath it is a 4.

Link to post
Share on other sites

ExBrowser works with xPath, Dan has made a good tool you can use:

 

https://www.bot-factory.com/xpath-builder-pro/

 

I have it but it doesn't add any offset. It just gives me the name of the button. When I try the code in xpath helper (chrome extension) it returns many results which means there many buttons with the same name.

 

I'm going to experiment with the brackets and a number at the end of the statement as mentioned above. Thanks for the suggestions.

Link to post
Share on other sites

I have it but it doesn't add any offset. It just gives me the name of the button. When I try the code in xpath helper (chrome extension) it returns many results which means there many buttons with the same name.

 

I'm going to experiment with the brackets and a number at the end of the statement as mentioned above. Thanks for the suggestions.

 

You may post the URL and element name you need here. so we can test.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...