Skip to content

Commit 805c7ec

Browse files
Ryan MitchellRyan Mitchell
authored andcommitted
Modified driver instantiation example
1 parent a9f4e71 commit 805c7ec

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

chapter13/3-interactiveTest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
from selenium.webdriver import ActionChains
55

66

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

1012
firstnameField = driver.find_element_by_name("firstname")

chapter13/4-dragAndDrop.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from selenium.webdriver.remote.webelement import WebElement
33
from selenium.webdriver import ActionChains
44

5-
driver = webdriver.PhantomJS(executable_path='phantomjs/bin/phantomjs')
5+
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
6+
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
7+
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')
8+
69
driver.get('http://pythonscraping.com/pages/javascript/draggableDemo.html')
710

811
print(driver.find_element_by_id("message").text)

chapter13/5-takeScreenshot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
from selenium.webdriver import ActionChains
44

55

6-
driver = webdriver.PhantomJS(executable_path='<Path to Phantom JS>')
6+
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
7+
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
8+
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')
9+
710
driver.implicitly_wait(5)
811
driver.get('http://www.pythonscraping.com/')
912
driver.get_screenshot_as_file('tmp/pythonscraping.png')

chapter13/6-combinedTest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ class TestAddition(unittest.TestCase):
77
driver = None
88
def setUp(self):
99
global driver
10-
driver = webdriver.PhantomJS(executable_path='<Path to Phantom JS>')
10+
#REPLACE WITH YOUR DRIVER PATH. EXAMPLES FOR CHROME AND PHANTOMJS
11+
driver = webdriver.PhantomJS(executable_path='../phantomjs-2.1.1-macosx/bin/phantomjs')
12+
#driver = webdriver.Chrome(executable_path='../chromedriver/chromedriver')
1113
url = 'http://pythonscraping.com/pages/javascript/draggableDemo.html'
1214
driver.get(url)
1315

0 commit comments

Comments
 (0)