Created
August 23, 2016 20:18
-
-
Save jyotiska/effc0c1df3da402b8e827b054414a150 to your computer and use it in GitHub Desktop.
Selenium Blog Post Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from selenium import webdriver | |
| import time | |
| driver = webdriver.Firefox() | |
| driver.get("http://jyotiska.github.io/") | |
| time.sleep(1) | |
| blog_link = driver.find_element_by_name("Blog") | |
| blog_link.click() | |
| assert "blog" in driver.current_url | |
| time.sleep(1) | |
| driver.back() | |
| time.sleep(1) | |
| github_link = driver.find_element_by_name("Github") | |
| github_link.click() | |
| assert "jyotiska" in driver.current_url | |
| time.sleep(1) | |
| driver.back() | |
| time.sleep(1) | |
| all_projects = [] | |
| projects = driver.find_element_by_id("projects").find_elements_by_css_selector("li") | |
| for item in projects: | |
| all_projects.append(item.text) | |
| assert len(all_projects) == 9 | |
| time.sleep(1) | |
| all_talks = [] | |
| talks = driver.find_element_by_id("talks").find_elements_by_css_selector("li") | |
| for item in talks: | |
| all_talks.append(item.text) | |
| assert len(all_talks) == 4 | |
| time.sleep(1) | |
| driver.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment