Jump to content

Trying to web scrape


Recommended Posts

Hi all!
 
I am just running stuck here I have read a multitude of tutorials on Google about how to control web browser using Autoit!
What I want is a simple command to input a text from my array, check if error and if not then copy the output into said array but in column two. Now I believe I can figure the array part, just the other part I need to figure.
 

Input:
<div class="inputs">
<input name="tbRegNum" type="text" id="[input]" defaultbutton="" class="mysize">
<input type="submit" name="btnRegNum" value="[same_text]" id="btnRegNum" class="submit">
</div>

Error:
<div id="message">
        [same_text] <a href="[url]">[same_text]</a>
</div>

Output:
<div id="intro">[text]<br>Type: [output]<br>[text]              <br>[text]<br>
</div>

 
Input is the HTML patch that has the text box (named [input]) that I want things to appear in. Line below is the button that would be awesome if Autoit could activate afterwards without the need for a mouse! [same_text] refers to what the button is saying like "search". It's the same name every time since it's obviously text on a button.
 
Error means if the search string does not exist then this will appear. As like button [same_text] never changes, neither do . If the easiest thing to do would be to simply let Autoit search for [same_text], then I believe that would be the optimal.
 
Output is what I want back and eventually into a second column on my array. [text] do changes depending on search result, but what I want is [output] and I believe this isn't either too hard for the one that knows how it all is done.
 
Also, I will be using proxies with this. How can I easiest let Autoit react to if the proxy is dead and website won't load? I would use "$oHttp.SetProxy(2,"")" to set it up I am quite sure of that. And if proxy is dead I use it again in a if loop (?). But how will I detect the dead proxy in the first place?
 
I thank you for your time and effort in helping me. Understand that I wishes not to share too too much about this website, but I will do my best to help you help me!

Link to comment
Share on other sites

I cannot even setup proxy..

FtpSetProxy(2, "192.99.187.0:8089")
HttpSetProxy(2, "192.99.187.0:8089")
Local $oIE = _IECreate("http://whatismyipaddress.com/")

Just shows my own IP, I am quite sure the seen proxy IP do work.

I tried my best with looking around in the different commands. Eventually stumbled over one that actually makes desired text to pop in:

; Open a browser with the form example, fill in a form field and submit the form

#include <IE.au3>

Local $oIE = _IE_Example("form")
Local $oForm = _IEFormGetObjByName($oIE, "ExampleForm")
Local $oText = _IEFormElementGetObjByName($oForm, "textExample")
_IEFormElementSetValue($oText, "Hey! It works!")
Sleep(2000)
_IEFormSubmit($oForm)

Replacing $oIE with my website, $oForm with the only form said website has being Form1 and $oText with   "tbRegNum" from above input makes it say "Hey! It Works!" just where I want it. But form submit seems to be a dud..

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...