Open xjr7670 opened 8 years ago
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.
@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?
Sorry, I am missing the executable path, specific in executable_path=''
my code is same as the book:
but when I run this code, I got this:
Traceback (most recent call last): File "use_selenium.py", line 6, in
driver = webdriver.PhantomJS(executable_path='')
File "D:\Python34\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 52, in init
self.service.start()
File "D:\Python34\lib\site-packages\selenium\webdriver\common\service.py", line 64, in start
stdout=self.log_file, stderr=self.log_file)
File "D:\Python34\lib\subprocess.py", line 848, in init
restore_signals, start_new_session)
File "D:\Python34\lib\subprocess.py", line 1104, in _execute_child
startupinfo)
OSError: [WinError 87] ▒▒▒▒▒▒▒▒
Exception ignored in: <bound method Service.del of <selenium.webdriver.phantomjs.service.Service object at 0x000000000307A940>>
Traceback (most recent call last):
File "D:\Python34\lib\site-packages\selenium\webdriver\common\service.py", line 163, in del
self.stop()
File "D:\Python34\lib\site-packages\selenium\webdriver\common\service.py", line 135, in stop
if self.process is None:
AttributeError: 'Service' object has no attribute 'process'
I am using windows8.1+python3.4, install selenium by pip3. And it's also this error occurs in my centos6.5 server patform