Hi All,
I'm new to automation testing. I'm trying to automate a product using
selenium. I have latest version of selenium web driver downloaded and
using python 3.1.
I want to test the product using IE 8/9 and Mozilla Firefox 3.6 and
Mozilla 6.0.
Please help me how to configure python library for selenium.
I have copied selenium folder which contains web driver and
selenium.py to Lib folder inside python folder.
Path: C:\Python31\Lib\selenium
The issue is on executing a sample codes getting error.
Traceback (most recent call last):
File "C:\Python31\selhq.py", line 1, in <module>
from selenium import webdriver
File "C:\Python31\lib\selenium\__init__.py", line 16, in <module>
from selenium import selenium
File "C:\Python31\lib\selenium\selenium.py", line 193
raise Exception, result
^
SyntaxError: invalid syntax
The example sample code is taken from selenium official website for
driver(and same error i'm getting for pyhton code generated using
selenium IDE for my product test case)
from selenium import webdriver
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait # available
since 2.4.0
import time
driver = webdriver.Firefox()
# go to the google home page
driver.get("
http://www.google.com")
# find the element that's name attribute is q (the google search box)
inputElement = driver.find_element_by_name("q")
# type in the search
inputElement.send_keys("Cheese!")
# submit the form (although google automatically searches now without
submitting)
inputElement.submit()
# the page is ajaxy so the title is originally this:
print (driver.title)
try:
# we have to wait for the page to refresh, the last thing that
seems to be updated is the title
WebDriverWait(driver, 10).until(lambda driver :
driver.title.lower().startswith("cheese!"))
# You should see "cheese! - Google Search"
print (driver.title)
finally:
driver.quit()
Reference of above code :
http://seleniumhq.org/docs/03_webdriver.html#internet-explorer-driver
Please help me to solve the above issue.
Thanks,
Subba Rao