English 中文(简体)
Automate Post Of Login Details User & Password Into Safari For Scraping
原标题:

I am wanting to automate the input of post variables on a login page for the purpose of webscraping. It would improve the process no end if I can get past the login page.

Then I can schedule some functions to run on cycle automatically. (Had a go with some CURL commands but could not get the result)

Thanks for any help,

lance

问题回答

Try looking at this article for some suggestions.

The magic part is:

tell application "Safari"
  activate
  tell (make new document) to set URL to "https://www.fedex.com/ship/shipEntryAction.do?method=doInitialEntry&origincountry=us&locallang=en&urlparams=us&sType=&programIndicator=0"
  delay 2

  set doc to document "FedEx | Ship Manager | Shipping"
  log (doc s name)
  do JavaScript "document.forms[ domesticShipmentActionForm ][ recipient.companyName ].value =  add " in doc
  do JavaScript "submitForm( doSelectRecipientCompanyName )" in doc
end tell

You can use TestPlan to do this. You can fully automate your tests, or you could just leave the browser open at the end and continue on your own manually.

For example, a login might look like:

GotoURL http://somesite.com/
SubmitForm with
  %Params% with
    %name% mylogin
    %pass% mypassword
  end
end

It works with both a browserless mode or with a backing browser. I ve only tested that with explorer and firefox, but I d be happy to help you get it running with Safari if you want.





相关问题
passing form variables into a url with php

I have the following form which allows a user to select dates/rooms for a hotel reservation. <form action="booking-form.php" method="post"> <fieldset> <div class="select-date">...

Error: "Cannot modify the return value" c#

I m using auto-implemented properties. I guess the fastest way to fix following is to declare my own backing variable? public Point Origin { get; set; } Origin.X = 10; // fails with CS1612 Error ...

C-style Variable initialization in PHP

Is there such a thing as local, private, static and public variables in PHP? If so, can you give samples of each and how their scope is demonstrated inside and outside the class and inside functions?

C#/.NET app doesn t recognize Environment Var Change (PATH)

In my C# app, I am programmatically installing an Oracle client if one is not present, which requires adding a dir to the PATH system environment variable. This all works fine, but it doesn t take ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

How to dynamically generate variables in Action Script 2.0

I have a for loop in action script which I m trying to use to dynamically create variable. Example for( i = 0 ; i &lt 3 ; i++) { var MyVar+i = i; } after this for loop runs, i would like to ...

热门标签