簡體   English   中英

是否可以在沒有驅動程序的情況下使用 Senenium?

[英]Is it possible to use Senenium without driver?

我想在spyder/Jupyter-notebook中使用selenium,但是無法下載驅動。 是否可以在不下載驅動程序的情況下以某種方式使用 selenium,例如在協作版本中

Selenium是一款主要啟用和支持web瀏覽器自動化的工具。 因此,它確實需要后端的 web 驅動程序。 文檔

要在您的自動化項目中使用 Selenium,您需要為您選擇的語言安裝語言綁定庫。 此外,您將需要 WebDriver 二進制文件用於您想要自動化和運行測試的瀏覽器。

此外,查看repo ,您會發現它確實需要驅動程序,具體取決於您計划使用的瀏覽器。

如果由於政策限制而無法安裝驅動程序,請與您的管理員聯系並解釋您需要它的原因; 他們也許可以為您安裝它。

如果您不想在本地運行它,您可以使用Remote驅動程序。 例如,您可以在 aws 設備場上運行它。如果您想在 aws 設備場上執行此操作,以下是一個示例:

https://docs.aws.amazon.com/devicefarm/latest/testgrid/testing-frameworks-python.html

import boto3
from selenium.webdriver import DesiredCapabilities
from selenium.webdriver import Remote
class MyPytestTests():
  def setup_method(self, method):
    devicefarm_client = boto3.client("devicefarm")
        testgrid_url_response = devicefarm_client.create_test_grid_url(
        projectArn= "arn:aws:devicefarm:us-west-2:111122223333:testgrid-project:123e4567-e89b-12d3-a456-426655440000",
      expiresInSeconds=300
      )
     desired_capabilities = DesiredCapabilities.FIREFOX
     desired_capabilities["platform"] = "windows"
     self.driver = Remote(testgrid_url_response['url'], desired_capabilities)

和拆解:

   def teardown_method(self, method):
    self.driver.quit()

(摘自 aws 文檔)

您可以使用無頭方法運行 selenium。 https://dev.to/googlecloud/using-headless-chrome-with-cloud-run-3fdp

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM