GoldenMike Posted May 26, 2015 Posted May 26, 2015 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 NextI 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
Danp2 Posted May 26, 2015 Posted May 26, 2015 You need to revise your xpath. As is, you are grabbing the first input with a type of image, which isn't necessarily the correct one. Latest Webdriver UDF Release Webdriver Wiki FAQs
GoldenMike Posted May 26, 2015 Author Posted May 26, 2015 Danp2,Thank you. I feel pretty dumb now. There is another input search I did not see. Should have assumed that if they did it in one place, they would do the other as well.Thanks,Mike
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now