【发布时间】:2016-09-27 16:16:49
【问题描述】:
我想通过我在本地 apache 服务器中的站点在 Python 中执行以下脚本:
#!/Python34/python
from selenium import webdriver
driver=webdriver.Firefox()
driver.get("C:\wamp64\www\desenvol\index.html")
elem1 = driver.find_element_by_link_text("call another page")
elem1.click()
apache 已正确配置,这是我与 php 代码一起使用的页面:
<!doctype html>
<html>
<head>
<title>Light Controller</title>
</head>
<?php
if (isset($_POST['LightON']))
{
exec('python hello.py');
echo("on");
}
?>
<form method="post">
<button name="LightON">Light ON</button>
</form>
</html>
【问题讨论】:
-
当前代码有什么错误?您的 Apache 用户是否设置了无密码 sudo?
-
实际上只是第一个按钮很重要(灯亮),因为我使用的是 WAMP。问题是没有任何反应,出现加载符号,但 Firefox 浏览器没有按预期打开。
-
您正在使用 WAMP?那么你甚至有
sudo命令吗?你用的是什么外壳? -
我更新了代码。我正在使用 Windows 10 中的 CMD-DOS。
-
python在%PATH%上吗?在常规命令提示符下运行命令会发生什么?
标签: php python html apache selenium