Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # To install the Python client library:
- # pip install -U selenium
- # Import the Selenium 2 namespace (aka "webdriver")
- from selenium import webdriver
- from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
- from selenium.webdriver.common.by import By
- # Remote
- driver = webdriver.Remote(command_executor='http://driver:4444/wd/hub', desired_capabilities=DesiredCapabilities.CHROME)
- # ------------------------------
- # The actual test scenario: Test the codepad.org code execution service.
- driver.get('http://thedemosite.co.uk/login.php')
- # Select the Python language option
- #python_link = driver.find_elements_by_xpath("//input[@name='lang' and @value='Python']")[0]
- #python_link.click()
- # Enter some text!
- username = driver.find_element_by_name('username')
- username.send_keys("admin")
- password = driver.find_element_by_name('password')
- password.send_keys("admin")
- # Submit the form!
- submit_button = driver.find_element_by_name('FormsButton2')
- submit_button.click()
- for line in driver.page_source():
- print line
- # Make this an actual test. Isn't Python beautiful?
- assert "Successful Login" in driver.page_source()
- # Close the browser!
- driver.quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement