python-scraping
python-scraping copied to clipboard
seleniumBasic.py in Chapter10 - 'Service' object has no attribute 'process'
Sorry, I am missing the executable path, specific in executable_path=''
my code is same as the book:
#!/usr/bin/env python3
import time
from selenium import webdriver
driver = webdriver.PhantomJS(executable_path='')
driver.get("http://www.pythonscraping.com/pages/javascript/ajaxDemo.html")
time.sleep(3)
print(driver.find_element_by_id("content").text)
driver.close()
but when I run this code, I got this:
Traceback (most recent call last):
File "use_selenium.py", line 6, in
I am using windows8.1+python3.4, install selenium by pip3. And it's also this error occurs in my centos6.5 server patform
Is phantom.js installed? Download PhantomJS Did you test the code with the path to phantom.js explicitly included?
From Chapter 10, Executing JavaScript in Python with Selenium
Depending on the location of your PhantomJS installation, you might also need to explicitly point Selenium in the right direction when creating a new PhantomJS WebDriver:
driver = webdriver.PhantomJS(executable_path='/path/to/download/ phantomjs-1.9.8-macosx/bin/phantomjs')
For these types of errors, that do not originate in the code from the book, but from selenium or other imported modules ("File D:\Python34\lib\site-packages\selenium\webdriver\common\service.py:), a search on google and or stackoverflow.com is in order.
A quick search via google for: "selenium webdriver AttributeError: 'Service' object has no attribute 'process', would be a good start.
http://stackoverflow.com/questions/37004635/python-selenium-exception-attributeerror-service-object-has-no-attribute-pr
@xjr7670 - Can you please confirm this fixes the issue for you? As this is not a problem with the code as published, can you comment and close this issue out?