Skip to content

Commit

Permalink
Modified driver instantiation example
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Mitchell authored and Ryan Mitchell committed Jan 13, 2017
1 parent a9f4e71 commit 805c7ec
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion chapter13/3-interactiveTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
from selenium.webdriver import ActionChains


driver = webdriver.PhantomJS(executable_path='phantomjs/bin/phantomjs')
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')
driver.get("http://pythonscraping.com/pages/files/form.html")

firstnameField = driver.find_element_by_name("firstname")
Expand Down
5 changes: 4 additions & 1 deletion chapter13/4-dragAndDrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
from selenium.webdriver.remote.webelement import WebElement
from selenium.webdriver import ActionChains

driver = webdriver.PhantomJS(executable_path='phantomjs/bin/phantomjs')
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')

driver.get('http://pythonscraping.com/pages/javascript/draggableDemo.html')

print(driver.find_element_by_id("message").text)
Expand Down
5 changes: 4 additions & 1 deletion chapter13/5-takeScreenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
from selenium.webdriver import ActionChains


driver = webdriver.PhantomJS(executable_path='<Path to Phantom JS>')
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')

driver.implicitly_wait(5)
driver.get('http://www.pythonscraping.com/')
driver.get_screenshot_as_file('tmp/pythonscraping.png')
4 changes: 3 additions & 1 deletion chapter13/6-combinedTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ class TestAddition(unittest.TestCase):
driver = None
def setUp(self):
global driver
driver = webdriver.PhantomJS(executable_path='<Path to Phantom JS>')
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')
url = 'http://pythonscraping.com/pages/javascript/draggableDemo.html'
driver.get(url)

Expand Down

0 comments on commit 805c7ec

Please sign in to comment.