Jump to content
UBot Underground

How To Write Xpath Good Syntax


Recommended Posts

Hello,

 

I'm just beginning with ExBrowser, and it is a big fail !

I am trying to click Login without success!

Here is the source code :

class="fixed contain-to-grid"> <nav
class="top-bar"><ul><li
class="name"><h1 class="site-name"><a
href="/">King Proxies</a></h1></li><li
class="toggle-topbar"><a
href="#"></a></li></ul> <section><ul
class="right"><li><a
href="/#proxylist">Download</a></li><li><a
href="/plans">Plans & pricing</a></li><li> <a
href="/docs">API</a></li><li
class="has-button"> <a
href="/register" class="small blue nice button">Log in / Register</a></li></ul> </section> </nav></div><div
class="container" role="main"> <header
id="homepage"><div
class="wrapper"><div
class="wrapper2"><div
class="row"><div
class="twelve columns text-center"><h2>The most reliable public proxy servers list</h2><h4>Thousands of http and socks proxies tested daily.</h4></div></div></div></div> </header><div
class="row"><div

And below my xpath

x://*[@class="small blue nice button"]

KZWlOOy.png

 

Any help would be appreciated.

Edited by Kill3rbko
Link to post
Share on other sites

How is so easy for you .... :(

Why i am so noob !!!! :(

 

It's working !!!

Thanks Insomnia! i will learn from this :)

 

Edit :

I'm really sorry to disturb, but is there any sample code on exbrowser to see how it is working?

 

Now i can not find the xpath for email and password.

The xpath i use fill the register field and not the login field.

 

this is the expression : //*[@id=UserEmail]

href="/register" class="small blue nice button">Log in / Register</a></li></ul> </section> </nav></div><div
class="container" role="main"><div
class="row"><div
class="five columns"><h1>Create an account</h1><p>Create an account and download the first 5 proxies for free. Our <a
href="/plans">subscription plans</a>, start at just $19.95.</p><fieldset><form
action="/register" class="nice" id="UserAddForm" method="post" accept-charset="utf-8"><div
style="display:none;"><input
type="hidden" name="_method" value="POST"/><input
type="hidden" name="data[_Token][key]" value="2b46a58d86b2ce0fe0cf16ba068ef6d077bcf80f" id="Token1868038849"/></div><div
class="form-field"><label
for="UserEmail">Your email address</label><input
name="data[User][email]" class="input-text medium input-text" maxlength="255" type="email" id="UserEmail"/></div><div
class="form-field"><label
for="UserPassword">Create a password</label><input
name="data[User][password]" class="input-text medium input-text" type="password" id="UserPassword"/></div><p
class="terms">By registering, you agree to the <a
href="/tos" data-reveal-id="tos">Terms of Service</a>.</p><div
class="submit"><input
class="button expand" type="submit" value="Register"/></div><div
style="display:none;"><input
type="hidden" name="data[_Token][fields]" value="62d98fd51f5c4f85c985b5bb3132d0edfa2669da%3A" id="TokenFields1177509518"/><input
type="hidden" name="data[_Token][unlocked]" value="" id="TokenUnlocked627454550"/></div></form></fieldset></div><div
class="two columns text-center"><div
style="font-size: 26px; margin-top: 31px; color: #6f6f6f;">OR</div></div><div
class="five columns"><h3>You can also sign up with:</h3><ul
class="block-grid one-up"><li><a
href="/auth/google" class="button secondary expand google">Google</a></li></ul><h5>Already have an account? Log in:</h5><fieldset><form
action="/login" id="LoginForm" class="nice" method="post" accept-charset="utf-8"><div
style="display:none;"><input
type="hidden" name="_method" value="POST"/><input
type="hidden" name="data[_Token][key]" value="2b46a58d86b2ce0fe0cf16ba068ef6d077bcf80f" id="Token328430634"/></div><div
class="form-field"><label
for="UserEmail">Email</label><input
name="data[User][email]" class="input-text medium input-text" maxlength="255" type="email" id="UserEmail"/></div><div
class="form-field"><label
for="UserPassword">Password</label><input
name="data[User][password]" class="input-text medium input-text" type="password" id="UserPassword"/></div><div
class="row"><div
class="six columns"><p>Remember Me <input
type="hidden" name="data[User][remember_me]" id="UserRememberMe_" value="0"/><input
type="checkbox" name="data[User][remember_me]"  value="1" id="UserRememberMe"/></div><div
class="six columns text-right"><p><a
href="/reset_password">Reset password</a></p></div></div><input
type="hidden" name="data[User][return_to]" id="UserReturnTo"/><div
class="submit"><input
class="button expand" type="submit" value="Log in"/></div><div
style="display:none;"><input
type="hidden" name="data[_Token][fields]" value="da8dace3fd57ce965efa9972ba6e16608cdf037a%3AUser.return_to" id="TokenFields975757871"/><input
type="hidden" name="data[_Token][unlocked]" value="" id="TokenUnlocked1399960315"/></div></form></fieldset></div></div><div
id="tos" class="reveal-modal xlarge"><div

unfortunately it is not the unique expression, how to indicate it is for form > action="login"  ?

 

I have tried this expression without success :

//*[@id=LoginForm]*/*[@id=UserEmail]

 

Thanks again for your time

Edited by Kill3rbko
Link to post
Share on other sites

type=""

class=""

id=""

name=""

anything=""

 

those are all called "attributes", you can use any of them or a combination of them. The idea is to get a unique one.

 

if it doesn't have an 'id' or 'class' like in "UserEmail" use something else, in this case "for".

More info,
https://www.w3schools.com/xml/xpath_intro.asp
 

Hope that helps...

Regards,
CD
 

  • Like 2
Link to post
Share on other sites

Thanks Docta, but i think i am the worst student ever seen ! :(

After 4 hours of testing no way.

Here is some path i have tried from many others

//form[@id='LoginForm'] and input[@id='UserEmail']
//label[@for='UserEmail']//input[@id='UserEmail']

I note with despair my extremely low level in this area. I am also aware that ExBrowser support is very clear on the point that we need to have some preliminary knowledge of xpath before using their EB plugin. I can't open a ticket for my problem,so I'm willing to pay for a tutorial example of connecting to a site and retrieving a list of data in order to better understand and avoid these unnecessary and disturbing questions on the forum.
Thank you for your understanding.

 

Link to post
Share on other sites

Hi.

 

You know that I have a full (FREE) course about Xpath right? So head over to Facebook and join the EXBrowser Group:

https://www.facebook.com/groups/ExBrowserPlugin/files/

 

There you will find the link to the tutorial videos in the files section. And there is also a Cheat Sheet (PDF) about it.

Cheers

Dan

  • Like 2
Link to post
Share on other sites

Thanks Dan,

Unfortunately i dont have a facebook account,

 

Thanks Docta,

Will watch again tutorials provided...

 

Be back soon !

 

I think facebook added an option to create an account. But might be a new feature  :P

 

Cheers

Dan

  • Like 1
Link to post
Share on other sites

Damn Dan, so no other choice :(

xpath open to me grrrr

 

I realize you said that you hate it but its worth learning even if it feels daunting at first.

 

Actually, forget xpath, go learn html and css first - its really not hard and you don't have to become an expert. But go make some simple html pages on your own. Then come back and learn xpath. It will be much easier then.

  • Like 1
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...