Jump to content

Selenium / Beautiful Soup / AutoItScript automation


Recommended Posts

I've been using AutoIt for years, I love it and it has helped me greatly. I recently started learning other languages to help expand my knowledge and found that other languages are much faster in some regards.

I'm trying to automate a login to http://www.eedistribution.com/. I have tried this for IE with BeautifulSoup:

driver = webdriver.Ie("D:\\Python\\IEDriverServer32.exe")
driver.get("http://www.entertainmentearth.com/eedistribution.asp")
inputName = driver.find_element_by_name("custnum").send_keys("user")
passWord = driver.find_element_by_name("password").send_keys("password")
submit = driver.find_element_by_xpath("//input[@type='image']").click()

and this for firefox with BeautifulSoup:

driver = webdriver.Firefox()
driver.get("http://www.eedistribution.com/")
inputName = driver.find_element_by_name("custnum").send_keys("user")
passWord = driver.find_element_by_name("password").send_keys("password")
submit = driver.find_element_by_xpath("//input[@type='image']").click()

The website has two sides. Wholesale distribution and consumer. For some reason when I use the above scripts it takes me to the consumer side when I want to go to the wholesale side. If I manually enter user / password then I get into the wholesale side, and if use AutoIt it takes me to the wholesale side as well (this is where I want to go). I can't seem to figure out why?

Here is the AutoItScript:

oIE = _IEAttach("ee")
$user = _IEGetObjByName($oIE, "custnum")
$login = _IEGetObjByName($oIE, "password")
$oInputs = _IETagNameGetCollection($oIE, "input")
$user.value = "user"
$login.value = "password"
For $oInput in $oInputs
   If StringInStr($oInput.outerhtml, "signin_white.gif") > 0 Then
      $oInput.click()
      ExitLoop
   EndIf
Next

I apologize in advance for this not strictly being a AutoIt question, but am trying to learn more about how the web works in general and can't seem to understand this. As I am not a programmer and completely self taught I thought maybe someone with more experience might have an answer for this.

Thanks,

 

Mike

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

×
×
  • Create New...