我正在尝试在我的网络服务器上运行此代码
#!/usr/bin/python
print "Content-type:text/html\r\n\r\n"
import time
from selenium import webdriver
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800, 600))
display.start()
phantomjs_path = "/usr/local/share/phantomjs-1.9.8-linux-x86_64/bin/phantomjs"
browser = webdriver.PhantomJS(executable_path=phantomjs_path,service_log_path=os.path.devnull)
browser.set_window_size(1400, 1000)
browser.get('http://www.google.com/xhtml');
time.sleep(5)
search_box = browser.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5)
browser.quit()
但浏览器显示以下消息
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
简单的脚本工作得很好,就像打印html文档一样,这意味着我的配置是正确的。 这是我的错误日志:
[Fri Sep 25 14:36:28.909899 2015] [cgid:error] [pid 922:tid 139922897643392] (2)No such file or directory: AH01241: exec of '/var/www/selenium-working.py' failed
[Fri Sep 25 14:36:28.910837 2015] [cgid:error] [pid 1245:tid 139922702849792] [client 127.0.0.1:58791] End of script output before headers: selenium-working.py
请帮忙。提前谢谢。