$scrape = 'python '.base_path().'Description\test.py 2>&1';
$output = shell_exec($scrape);
echo($output);
其中test.py为:
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
options = Options()
print("Created Options")
options.add_argument("--headless")
print("Added options")
binary = FirefoxBinary("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe")
fp = webdriver.FirefoxProfile()
print("Binary set up")
driver = webdriver.Firefox(firefox_binary=binary, firefox_profile=fp, firefox_options = options)
driver.get("http://www.google.com")
print("Going to URL")
driver.quit()
print("Quit")
我为python、geckdodriver和firefox授予了整个lib目录的权限,以便在IIS_IUSRS(使用Windows)下进行完全控制。
Geckodriver的日志:
1523551010316 geckodriver INFO geckodriver 0.19.0
1523551010337 geckodriver INFO Listening on 127.0.0.1:55452
1523552906639 geckodriver INFO geckodriver 0.19.0
1523552906660 geckodriver INFO Listening on 127.0.0.1:64886
1523552982150 geckodriver INFO geckodriver 0.19.0
1523552982157 geckodriver INFO Listening on 127.0.0.1:65274
1523552996397 geckodriver INFO geckodriver 0.19.0
1523552996403 geckodriver INFO Listening on 127.0.0.1:65361
1523553042485 geckodriver INFO geckodriver 0.19.0
1523553042491 geckodriver INFO Listening on 127.0.0.1:49225
1523553453916 geckodriver INFO geckodriver 0.19.0
1523553453924 geckodriver INFO Listening on 127.0.0.1:51324
1523553557325 geckodriver INFO geckodriver 0.19.0
1523553557332 geckodriver INFO Listening on 127.0.0.1:51851
1523553572336 geckodriver INFO geckodriver 0.19.0
1523553572343 geckodriver INFO Listening on 127.0.0.1:51943
1523553584227 geckodriver INFO geckodriver 0.19.0
1523553584236 geckodriver INFO Listening on 127.0.0.1:52020
1523553969221 geckodriver INFO geckodriver 0.19.0
1523553969254 geckodriver INFO Listening on 127.0.0.1:53947
1523554425807 geckodriver INFO geckodriver 0.19.0
1523554425830 geckodriver INFO Listening on 127.0.0.1:56253
1523554461095 geckodriver INFO geckodriver 0.19.0
1523554461102 geckodriver INFO Listening on 127.0.0.1:56446
1523554524912 geckodriver INFO geckodriver 0.19.0
1523554524919 geckodriver INFO Listening on 127.0.0.1:56788
1523554661450 geckodriver INFO geckodriver 0.19.0
1523554661457 geckodriver INFO Listening on 127.0.0.1:57478
1523554945239 geckodriver INFO geckodriver 0.19.0
1523554945245 geckodriver INFO Listening on 127.0.0.1:58934
1523555132097 geckodriver INFO geckodriver 0.19.0
1523555132104 geckodriver INFO Listening on 127.0.0.1:59859
1523555833096 geckodriver INFO geckodriver 0.19.0
1523555833171 geckodriver INFO Listening on 127.0.0.1:63326
1523556541828 geckodriver INFO geckodriver 0.19.0
1523556541849 geckodriver INFO Listening on 127.0.0.1:50425
1523557052268 geckodriver INFO geckodriver 0.19.0
1523557052288 geckodriver INFO Listening on 127.0.0.1:53022
1523557865989 geckodriver INFO geckodriver 0.19.0
1523557865996 geckodriver INFO Listening on 127.0.0.1:57094
1523558364753 geckodriver INFO geckodriver 0.19.0
1523558364761 geckodriver INFO Listening on 127.0.0.1:59596
1523558692756 geckodriver INFO geckodriver 0.19.0
1523558692763 geckodriver INFO Listening on 127.0.0.1:61265
1523559379217 geckodriver INFO geckodriver 0.19.0
1523559379240 geckodriver INFO Listening on 127.0.0.1:64505
1523559433741 geckodriver INFO geckodriver 0.19.0
1523559433763 geckodriver INFO Listening on 127.0.0.1:64792
1523559454014 geckodriver INFO geckodriver 0.19.0
1523559454021 geckodriver INFO Listening on 127.0.0.1:64913
1523559499598 geckodriver INFO geckodriver 0.19.0
1523559499605 geckodriver INFO Listening on 127.0.0.1:65159
1523559825949 geckodriver INFO geckodriver 0.19.0
1523559825956 geckodriver INFO Listening on 127.0.0.1:50459
1523559827139 geckodriver INFO geckodriver 0.19.0
1523559827146 geckodriver INFO Listening on 127.0.0.1:50470
1523560435473 geckodriver INFO geckodriver 0.19.0
1523560435531 geckodriver INFO Listening on 127.0.0.1:53559
1523562230663 geckodriver INFO geckodriver 0.19.0
1523562230687 geckodriver INFO Listening on 127.0.0.1:62289
1523564088330 geckodriver INFO geckodriver 0.19.0
1523564088338 geckodriver INFO Listening on 127.0.0.1:54981
1523564554561 geckodriver INFO geckodriver 0.19.0
1523564554582 geckodriver INFO Listening on 127.0.0.1:57277
1523564576099 geckodriver INFO geckodriver 0.19.0
1523564576106 geckodriver INFO Listening on 127.0.0.1:57397
1523564596509 geckodriver INFO geckodriver 0.19.0
1523564596517 geckodriver INFO Listening on 127.0.0.1:57517
1523566668455 geckodriver INFO geckodriver 0.19.0
1523566668462 geckodriver INFO Listening on 127.0.0.1:51277
1523566841445 geckodriver INFO geckodriver 0.19.0
1523566841453 geckodriver INFO Listening on 127.0.0.1:52131
1523567215532 geckodriver INFO geckodriver 0.19.0
1523567215540 geckodriver INFO Listening on 127.0.0.1:53967
1523567239768 geckodriver INFO geckodriver 0.19.0
1523567239776 geckodriver INFO Listening on 127.0.0.1:54103
1523567265282 geckodriver INFO geckodriver 0.19.0
1523567265288 geckodriver INFO Listening on 127.0.0.1:54242
1523567277430 geckodriver INFO geckodriver 0.19.0
1523567277438 geckodriver INFO Listening on 127.0.0.1:54321
1523567285360 geckodriver INFO geckodriver 0.19.0
1523567285367 geckodriver INFO Listening on 127.0.0.1:54375
1523567562191 geckodriver INFO geckodriver 0.19.0
1523567562199 geckodriver INFO Listening on 127.0.0.1:55752
1523568013582 geckodriver INFO geckodriver 0.19.0
1523568013603 geckodriver INFO Listening on 127.0.0.1:58035
1523568126114 geckodriver INFO geckodriver 0.19.0
1523568126121 geckodriver INFO Listening on 127.0.0.1:58597
1523568204080 geckodriver INFO geckodriver 0.19.0
1523568204089 geckodriver INFO Listening on 127.0.0.1:58995
1523568236866 geckodriver INFO geckodriver 0.19.0
1523568236873 geckodriver INFO Listening on 127.0.0.1:59169
1523568365663 geckodriver INFO geckodriver 0.19.0
1523568365670 geckodriver INFO Listening on 127.0.0.1:59651
1523568583373 geckodriver INFO geckodriver 0.19.0
1523568583380 geckodriver INFO Listening on 127.0.0.1:60709
1523568984663 geckodriver INFO geckodriver 0.19.0
1523568984683 geckodriver INFO Listening on 127.0.0.1:62636
1523569163782 geckodriver INFO geckodriver 0.19.0
1523569163804 geckodriver INFO Listening on 127.0.0.1:63502
1523579734024 geckodriver INFO geckodriver 0.19.0
1523579734046 geckodriver INFO Listening on 127.0.0.1:49377
1523581385149 geckodriver INFO geckodriver 0.19.0
1523581385171 geckodriver INFO Listening on 127.0.0.1:57493
1523581448830 geckodriver INFO geckodriver 0.19.0
1523581448845 geckodriver INFO Listening on 127.0.0.1:57821
1523607057941 geckodriver INFO geckodriver 0.19.0
1523607058145 geckodriver INFO Listening on 127.0.0.1:50889
1523607183263 geckodriver INFO geckodriver 0.19.0
1523607183306 geckodriver INFO Listening on 127.0.0.1:51099
1523607240431 geckodriver INFO geckodriver 0.19.0
1523607240511 geckodriver INFO Listening on 127.0.0.1:51195
1523623712258 geckodriver INFO geckodriver 0.19.0
1523623712386 geckodriver INFO Listening on 127.0.0.1:49413
1523624414430 geckodriver INFO geckodriver 0.19.0
1523624414437 geckodriver INFO Listening on 127.0.0.1:49491
1523624471867 geckodriver INFO geckodriver 0.19.0
1523624471873 geckodriver INFO Listening on 127.0.0.1:49514
1523624716169 geckodriver INFO geckodriver 0.19.0
1523624716175 geckodriver INFO Listening on 127.0.0.1:49544
1523624783033 geckodriver INFO geckodriver 0.19.0
1523624783040 geckodriver INFO Listening on 127.0.0.1:49566
1523625431597 geckodriver INFO geckodriver 0.19.0
1523625431603 geckodriver INFO Listening on 127.0.0.1:49616
1523625702932 geckodriver INFO geckodriver 0.19.0
1523625702939 geckodriver INFO Listening on 127.0.0.1:49644
1523641970187 geckodriver INFO geckodriver 0.19.0
1523641970231 geckodriver INFO Listening on 127.0.0.1:50576
1523642534699 geckodriver INFO geckodriver 0.19.0
1523642534706 geckodriver INFO Listening on 127.0.0.1:50625
1523642573251 geckodriver INFO geckodriver 0.19.0
1523642573257 geckodriver INFO Listening on 127.0.0.1:50647
1523642715989 geckodriver INFO geckodriver 0.19.0
1523642715996 geckodriver INFO Listening on 127.0.0.1:50672
1523643125879 geckodriver INFO geckodriver 0.19.0
1523643125885 geckodriver INFO Listening on 127.0.0.1:50705
1523643319804 geckodriver INFO geckodriver 0.19.0
1523643319810 geckodriver INFO Listening on 127.0.0.1:50741
1523645004597 geckodriver INFO geckodriver 0.19.0
1523645004604 geckodriver INFO Listening on 127.0.0.1:50822
1523645077355 geckodriver INFO geckodriver 0.19.0
1523645077361 geckodriver INFO Listening on 127.0.0.1:50844
1523645468905 geckodriver INFO geckodriver 0.19.0
1523645468912 geckodriver INFO Listening on 127.0.0.1:50887
1523645536572 geckodriver INFO geckodriver 0.19.0
1523645536579 geckodriver INFO Listening on 127.0.0.1:50911
1523645646052 geckodriver INFO geckodriver 0.19.0
1523645646060 geckodriver INFO Listening on 127.0.0.1:50934
1523646298145 geckodriver INFO geckodriver 0.19.0
1523646298151 geckodriver INFO Listening on 127.0.0.1:50983
1523646904316 geckodriver INFO geckodriver 0.19.0
1523646904323 geckodriver INFO Listening on 127.0.0.1:51024
1523647702202 geckodriver INFO geckodriver 0.19.0
1523647702209 geckodriver INFO Listening on 127.0.0.1:51127
1523647800626 geckodriver INFO geckodriver 0.19.0
1523647800633 geckodriver INFO Listening on 127.0.0.1:51149
1523647849026 geckodriver INFO geckodriver 0.19.0
1523647849032 geckodriver INFO Listening on 127.0.0.1:51170
1523647970017 geckodriver INFO geckodriver 0.19.0
1523647970024 geckodriver INFO Listening on 127.0.0.1:51205
1523647982449 geckodriver INFO geckodriver 0.19.0
1523647982456 geckodriver INFO Listening on 127.0.0.1:51225
1523648024245 geckodriver INFO geckodriver 0.19.0
1523648024251 geckodriver INFO Listening on 127.0.0.1:51246
1523648280882 geckodriver INFO geckodriver 0.19.0
1523648280889 geckodriver INFO Listening on 127.0.0.1:51275
1523648711661 geckodriver INFO geckodriver 0.19.0
1523648711710 geckodriver INFO Listening on 127.0.0.1:51304
1523648876955 geckodriver INFO geckodriver 0.19.0
1523648876962 geckodriver INFO Listening on 127.0.0.1:51342
1523648981745 geckodriver INFO geckodriver 0.19.0
1523648981752 geckodriver INFO Listening on 127.0.0.1:51364
1523649029576 geckodriver INFO geckodriver 0.19.0
1523649029582 geckodriver INFO Listening on 127.0.0.1:51383
1523650025386 geckodriver INFO geckodriver 0.19.0
1523650025392 geckodriver INFO Listening on 127.0.0.1:51443
1523650231426 geckodriver INFO geckodriver 0.19.0
1523650231447 geckodriver INFO Listening on 127.0.0.1:51512
1523650784379 geckodriver INFO geckodriver 0.19.0
1523650784400 geckodriver INFO Listening on 127.0.0.1:51676
1523651138455 geckodriver INFO geckodriver 0.20.1
1523651138478 geckodriver INFO Listening on 127.0.0.1:51722
1523651421970 geckodriver INFO geckodriver 0.20.1
1523651421979 geckodriver INFO Listening on 127.0.0.1:51816
1523651539385 geckodriver INFO geckodriver 0.20.1
1523651539393 geckodriver INFO Listening on 127.0.0.1:51845
1523651563942 geckodriver INFO geckodriver 0.20.1
1523651563953 geckodriver INFO Listening on 127.0.0.1:51867
1523651617176 geckodriver INFO geckodriver 0.20.1
1523651617184 geckodriver INFO Listening on 127.0.0.1:51898
1523651955634 geckodriver INFO geckodriver 0.20.1
1523651955642 geckodriver INFO Listening on 127.0.0.1:51933
1523651972841 geckodriver INFO geckodriver 0.20.1
1523651972849 geckodriver INFO Listening on 127.0.0.1:51954
1523652422260 geckodriver INFO geckodriver 0.20.1
1523652422269 geckodriver INFO Listening on 127.0.0.1:51990
1523652679606 geckodriver INFO geckodriver 0.20.0
1523652679631 geckodriver INFO Listening on 127.0.0.1:52034
1523653035745 geckodriver INFO geckodriver 0.20.0
1523653035754 geckodriver INFO Listening on 127.0.0.1:52112
1523653444434 geckodriver INFO geckodriver 0.20.0
1523653444442 geckodriver INFO Listening on 127.0.0.1:52201
1523653445096 geckodriver INFO geckodriver 0.20.0
1523653445104 geckodriver INFO Listening on 127.0.0.1:52206
1523653445765 geckodriver INFO geckodriver 0.20.0
1523653445773 geckodriver INFO Listening on 127.0.0.1:52217
1523653447197 geckodriver INFO geckodriver 0.20.0
1523653447205 geckodriver INFO Listening on 127.0.0.1:52229
1523653447399 geckodriver INFO geckodriver 0.20.0
1523653447408 geckodriver INFO Listening on 127.0.0.1:52231
1523653455732 geckodriver INFO geckodriver 0.20.0
1523653455740 geckodriver INFO Listening on 127.0.0.1:52257
1523653695320 geckodriver INFO geckodriver 0.20.0
1523653695328 geckodriver INFO Listening on 127.0.0.1:52287
1523656451072 geckodriver INFO geckodriver 0.20.0
1523656451081 geckodriver INFO Listening on 127.0.0.1:52419
1523702123572 geckodriver INFO geckodriver 0.20.0
1523702123607 geckodriver INFO Listening on 127.0.0.1:54308
1523702293855 geckodriver INFO geckodriver 0.20.0
1523702293864 geckodriver INFO Listening on 127.0.0.1:54335
产生错误:
文件“C:\inetpub\wwwroot\jobdescription\test.py”,第13行,在driver=webdriver.firefox(firefox_options=options,firefox_binary=binary)文件“C:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\selenium\webdriver\firefox\webdriver.py”,第162行,在init keep_alive=true)文件“_profile)文件”C:\users\administrator\appdata\local\programs\python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py“,第243行,在start_session response=self.execute(命令.new_session,parameters)文件”C:\users\administrator\appdata\local\programs\python\python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py“,第312行,在execute self.error_handler.check_response(响应)文件”ackages\selenium\webdriver\remote\errorhandler.py“,第242行,在check_response中引发exception_class(消息,屏幕,堆栈跟踪)selenium.common.exceptions.webdriverexception:消息:权限被拒绝
好的,这将是我得到的每个错误的所有答案的列表,这可能会对未来的人有所帮助。
WebDriverException:消息:找不到匹配的功能集
当您的某个程序过期时,这个错误似乎会运行。IE:Selenium/Firefox/Geckodriver。我建议将它们全部更新/检查它们是否兼容,哪些版本彼此不兼容)。
更新geckodriver
WebDriverException:消息:连接重置
尝试使用火狐的夜间版本,并将二进制路径更新到它。
问题内容: 我在树莓派上有一个带有2个按钮(打开和关闭)的PHP网页,“打开”按钮重定向到On.php,“关闭”按钮重定向到Off.php在“ / usr / lib / cgi-bin”中,我有一个python脚本我想执行(script.py),我可以通过在终端上键入以下内容来完美地执行它 如果我从终端执行此操作,它将起作用。 问题是我的“ / var / www”文件夹中的PHP文件(On.p
您好,我正在尝试在apache2服务器上运行Raspberry Pi,使用PHP中的pyautogui库执行Python脚本。从命令行执行Python脚本时,我没有遇到任何问题,但通过PHP的“shell_exec”执行时,我收到以下错误消息: 错误登录apache2: 回溯(最近一次调用):文件“/home/pi/Projects/Python/wakeUp.py”,第2行,在导入pyautog
问题内容: 我正在尝试使用PHP运行Python程序。这是代码 这可以通过命令行运行,但不能通过浏览器运行。我正在使用Apache,因此可能需要正确的权限?我对Linux还是很陌生,不知道如何使它工作。 任何帮助,将不胜感激! 编辑1: 尝试使用,但没有任何反应。我给出了脚本的完整路径。使脚本可执行,但是没有运气。我可以在服务器上尝试其他任何方法吗?(这是一个CentOS 5) 问题答案: 您需要
问题内容: 我想从PHP运行Python脚本。该脚本的语法很好,当我从命令行运行它时,它会在它旁边生成一个图像文件。当我从命令行运行PHP文件(包含Python exec)时,它将生成一个图像文件。很好。问题是:当我使用浏览器并运行PHP时,它不会生成任何图像文件。我使用的是Xubuntu OS。 问题答案: 问题是matplotlib后端设置。我更改为“ Agg”,并且plot函数正常运行。
我想在macos上使用apache2从PHP文件执行Python脚本。我能够执行简单的python脚本,如: 从PHP: 巨蟒 输出是: 但当我尝试导入以下包时: 我得到: 我的问题是,有人知道: 1–我如何使这些(以及任何其他)软件包工作? 2–shell_exec当前正在执行python2。如何添加Python 3?(如果我编写python3而不是python将无法工作)
问题内容: 我有一个简单的PHP函数,该函数应在调用时执行Pyton脚本。我已经在我的php程序中多次尝试了这种功能,但是这次以某种方式该功能根本不执行python脚本。当我从命令提示符下访问脚本并运行时,它将成功执行。我要提到的一件事是,该脚本具有python的NLTK库的一些认真实现,并且执行和执行其操作(即数据处理并存储到db)需要20秒钟以上。执行延迟是否会导致此问题,或者这次我还缺少其他