如何在Android版Unity上使用Selenium



我在Android版Unity上遇到一个错误。

我的代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;
using UnityCursova;
using UnityEngine.UI;
public class MainProgram : MonoBehaviour
{
[SerializeField]
public Text FirstText;
IWebDriver driver;
void Start()
{
driver = new ChromeDriver(@"Assets/Packages/Selenium.Chrome.WebDriver.85.0.0/driver/");

driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
driver.Navigate().GoToUrl("https://dekanat.lnu.edu.ua/cgi-bin/classman.cgi?n=999");

}
// Update is called once per frame
void Update()
{

}
}

错误:

Win32Exception: ApplicationName='Assets/Packages/Selenium.Chrome.WebDriver.85.0.0/driver/chromedriver.exe', CommandLine='--port=49237', CurrentDirectory='', Native error= The system cannot find the file specified.

您就快到了。您只需要将可执行文件的名称,即chromedriver.exe添加到现有字符串@"Assets/Packages/Selenium.Chrome.WebDriver.85.0.0/driver/"中。

实际上,你的代码行将是:

driver = new ChromeDriver(@"Assets/Packages/Selenium.Chrome.WebDriver.85.0.0/driver/chromedriver.exe");

相关内容

  • 没有找到相关文章