我有python脚本(使用selenium),该脚本通过单击Odoo中的按钮来运行。该脚本通过chromedriver通过GUI运行chrome。当它尝试运行时,我出现错误:
从chrome位置/ usr / bin / google-chrome开始的过程为no运行时间更长,因此ChromeDriver认为Chrome崩溃了
所有安装在装有Hyper-V的计算机上的Ubuntu 18.04虚拟机上(在Windows上)我知道显示此错误是因为脚本无权访问X服务器。所以我将用户添加到X:xhost + SI:localuser:odoo_user
但是我仍然有同样的问题:(
Yesh,当我在Odoo中使用硒时遇到同样的问题,请检查您的chrome版本并下载适用于您的chrome的chrome驱动程序,然后将其移动到您的“ usr / bin”,以对该位置具有完全权限并在下面尝试此代码。
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def test(self):
driver = webdriver.Chrome()
driver.get("www.google.com")