I had a devil of a time figuring this out. It wasn't documented on the web anywhere I could find. I ended up reading the webdriver init.py to find out.
-
So no one else has to go through this hassle, this is how you do it: # Create a new instance of the Internet Explorer driver browser = webdriver.Ie() You'll also want to do this "Protected Mode must be set to the same value (enabled or disabled) for all zones" in IE's security settings if your on Vista or Windows 7.– AaronOct 19, 2011 at 21:23
-
I tried to post this as an answer, but I need 100 reputation points. That is a stupid requirement.– AaronOct 19, 2011 at 21:24
-
Aaron, if you have a complaint or a suggestion about StackExchange, please click the "meta" link (two links to the left of the search box in the upper right-hand corner of the page) and post it there, preferably as a question, e.g. "Why do I need 100 reputation points to post an answer to my own question?"– user246Oct 19, 2011 at 21:43
-
Aaron, I can understand your frustration. It does seem like a silly requirement, but a lot of new users on a SE site will post comments or edits as answers. So the reputation requirement is there to make sure someone has exposure to the community before they are allowed to fall into that trap. The unfortunate consequence of this (and other 'features' of its kind) is that it seems to punish those who actually read the FAQ and understand how to use the features available. Fear not, 100 rep is... pretty easy to get :-) and you'll be able to post it in no time.– corsiKa ♦Oct 19, 2011 at 23:46
-
1Fair enough. Yeah, I understand the need for such things. Some barrier to entry is always good for websites. Just frustrating when you are a "power user" and already know how things work. ;-)– AaronOct 20, 2011 at 1:31
4 Answers
from selenium import webdriver
driver = webdriver.Ie()
Also see comment above about "Protected Mode".
This is how it can be done -
- Download selenium from here https://pypi.python.org/pypi/selenium
- Assuming that you are on windows use - python setup.py install
- Download IEDriverServer.exe and put it in your path
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Ie("C:\\Python34\\IEDriverServer.exe")
//Your tests here
driver.close()
"from selenium import webdriver driver = webdriver.Ie()"
Eclipse is telling me that "the method IE is undefined for the type WebDriver"
-
This is not an answer to the question, if you are having problems then start a new question Aug 29, 2012 at 23:58
-
I agree with Phil, but will add that it sounds like the import might be failing. Make sure you have Selenium installed (e.g. pip install selenium).– AaronAug 30, 2012 at 22:07