Hi Everyone,
I wrote a few automated scripts to test my understanding of selenium
and python and was able to get them to work on Firefox. This one will
add a List Group to my Yahoo email account so that I can later assign
Contacts to this new list group.
Now I want to convert this script to work for IE8 browser on Windows.
Thought all I had to do was change from
self.driver = webdriver.Firefox()
to
self.driver = webdriver.Ie().
However, when I try to execute the script, I get the raised exception
below
E
======================================================================
ERROR: test_yahoo_create_list_ie (__main__.YahooCreateListIE)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:/Python27/PythonPrograms/SeleniumTestCases/
YahooCreateList_IE.py", line 9, in setUp
self.driver = webdriver.Ie()
File "C:\Python27\lib\site-packages\selenium\webdriver\ie
\webdriver.py", line 45, in __init__
raise WebDriverException("Unable to load the IEDriver.dll
component")
WebDriverException: Message: 'Unable to load the IEDriver.dll
component'
----------------------------------------------------------------------
Ran 1 test in 0.016s
FAILED (errors=1)
Traceback (most recent call last):
File "C:/Python27/PythonPrograms/SeleniumTestCases/
YahooCreateList_IE.py", line 49, in <module>
unittest.main()
File "C:\Python27\lib\unittest\main.py", line 95, in __init__
self.runTests()
File "C:\Python27\lib\unittest\main.py", line 231, in runTests
sys.exit(not self.result.wasSuccessful())
SystemExit: True
*************************************************************************************
See actual script below:
Can anyone tell me how to correct this problem? And are they any
special quirks that I need to worry about when you run on IE browser?
Thanks for any help or suggestions.
Appreciate it.
Ron
*************************************************************************************
from
selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.support.ui import WebDriverWait
import unittest, time, re
class YahooCreateListIE(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Ie()
self.driver.implicitly_wait(30)
self.base_url = "
http://www.yahoo.com/"
self.verificationErrors = []
def test_yahoo_create_list_ie(self):
driver = self.driver
driver.get(self.base_url)
driver.find_element_by_xpath("//*[@id='default-p_29445946-bd']/
ul/li[1]/a").click()
driver.find_element_by_id("username").clear()
driver.find_element_by_id("username").send_keys("
x...@yahoo.com")
driver.find_element_by_id("passwd").clear()
driver.find_element_by_id("passwd").send_keys("ppp")
driver.find_element_by_id(".save").click()
# Click on Mail link
driver.find_element_by_xpath("//*[@id='pa-u_14782488-bd']/a/
span[2]").click()
# Click on the Contacts tab
driver.find_element_by_xpath("//a[@id='tabcontacts']/
b").click()
time.sleep(5)
# Need to switch to iframe which contains search fi(eld
driver.switch_to_frame("abIframeTab")
driver.find_element_by_xpath("//a[@title='New List']").click()
# click New List button
driver.find_element_by_xpath("//input[@id='new-list-
name']").clear()
driver.find_element_by_xpath("//input[@id='new-list-
name']").send_keys("NewTestGroup")
# Save new assignment
driver.find_element_by_xpath("//span[@id='okayModalOverlay']/
a").click()
time.sleep(5)
def is_element_present(self, how, what):
try: self.driver.find_element(by=how, value=what)
except NoSuchElementException, e: return False
return True
def tearDown(self):
self.driver.quit()
self.assertEqual([], self.verificationErrors)
if __name__ == "__main__":
unittest.main()