xvfbwrapper不工作

2024-09-27 22:38:32 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在不打开浏览器的情况下运行python selenium脚本。我已经在rhel上安装了xvfbwrapper-0.1.3,并编辑了我的代码:

from selenium import webdriver,selenium
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select
from selenium.common.exceptions import NoSuchElementException
import unittest, time
from xvfbwrapper import Xvfb


class SeleTry(unittest.TestCase):
   def setUp(self):
        try:
            vdisplay = Xvfb(width=1280, height=720)
            vdisplay.start()
            self.driver = webdriver.Firefox()
            self.driver.implicitly_wait(10)
         .....//rest of the code//

当我试图执行它的时候,它总是抛出一个EER:

^{pr2}$

因为我是新来的,我不明白我错了什么?在


Tags: fromimportself脚本driverselenium情况浏览器

热门问题