python - 在托管应用程序中使用 Selenium ?

标签 python django selenium selenium-webdriver

我想使用我在 DigitalOcean 托管的 Django 应用程序单击一个按钮。

这是我离线操作的方法:

import selenium.webdriver as webdriver

firefox = webdriver.Firefox()
firefox.get("http://www.hltv.org/match/2296366-gplay-gamers2-acer-predator-masters-powered-by-intel")

element = firefox.find_element_by_id("voteteam1")
element.click()

但是我可以在线使用它吗?也许还有其他解决方案?

最佳答案

您需要在 Linux 机器上以 headless 方式使用 Firefox。以下文章应该有所帮助 -

http://www.installationpage.com/selenium/how-to-run-selenium-headless-firefox-in-ubuntu/

关于python - 在托管应用程序中使用 Selenium ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30727894/

相关文章:

Python - json 中的 `\n`

python - Django 表单 is_valid() 缺少 1 个必需的位置参数 : 'self'

c# - NoSuchWindowException 未处理 : Unable to find element on closed window. IE 11 - Selenium C#

python - Selenium Webdriver - Python - leboncoin - pb 选择带重音的按钮

python - NetworkX - 如何写入 csv 多重中心性指标

python - 使用 Django 管理时未保存 ManyToMany 字段

python - Python 装饰器做什么,它的代码在哪里?

java - Selenium/Testng - 使用 testng.xml 中的参数时 IF 语句不起作用

python - 如何为可使用任意数量的 Any 类型的关键字参数调用的类型定义 Python 协议(protocol)?

python - 使用 TENSORFLOW 进行多标签分类---COST 和 Weights 中的 NaN