[英]Using RemoteDebugger to debug C# mono program on Raspberry Pi 3
[英]Selenium on Raspberry Pi using Mono (C#)
我已经使用硒编写了C#
图表。 在Windows上使用它时,它的性能很好,但在Rapsberry Pi上则不能。 [它不含硒部分也可以工作]。
这是代码:
var options = new FirefoxOptions();
options.BrowserExecutableLocation = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
//IWebDriver driver = new FirefoxDriver(options); // WINDOWS VERSION
IWebDriver driver = new FirefoxDriver(); // LINUX VERSION
string xpath = "html/body/div[1]/div/main/div/section/section[2]/div/div[2]/div[1]/div/div/textarea";
string xpathButton = "html/body/div[1]/div/main/div/section/section[2]/div/div[2]/div[1]/div/button";
driver.Url = myurl;
driver.FindElement(By.XPath(xpathButton)).Click();
List<IWebElement> webElems = driver.FindElements(By.XPath(xpath)).ToList();
string comparestring = "";
int comparecounter = 0;
foreach (IWebElement element in webElems)
{
comparestring = element.Text;
}
我在树莓派上不断收到以下错误:
拒绝连接
和:OpenQA.Selenium.WebDriverException:无法在OpenQA.Selenium.Remoter.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Remote.Response errorResponse(0x00000)处找到OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(0x00000)在OpenQA.Selenium.Remoter.Remote.Re: .Open(System.String driverCommandToExecute,System.Collections.Generic.Dictionary`2参数)[0x00000]在OpenQA.Selenium.Remote.RemoteWebDriver.StartSession中为0(在OpenQA.Selenium在:0中为[0x00000])。 OpenQA.Selenium.Firefox.FirefoxDriver.ctor(OpenQA.Selenium.Firefox.FirefoxDriverService服务,OpenQA.Selenium.Firefox.FirefoxOptions选项,TimeSpan)中位于:0的Remote.RemoteWebDriver..ctor(ICommandExecutor命令执行程序,ICapabilitiesdesireCapabilities)[0x00000] commandTimeout)在OpenQA.Selenium.Firefox.FirefoxDriver..ctor中以0表示的[0x00000](OpenQA.Selenium.Firefox.FirefoxOptions选项)在OpenQA.Selenium.Firefox.FirefoxDriver..ctor中以0表示的[0x00000]()[0x00000 ]在Dialga.MyBot + c_的:0中 _async8.MoveNext()[0x00000] in:0
这样我就可以了。 它无法正常运行的原因是Firefox与geckodriver版本之间的不匹配。 我通过下载Firefox 52.2-ESR并使用geckdrover 1.7解决了该问题。 [硒3.4]。
遗憾的是,Firefox是降低树莓派速度的一种方式,因此我将其全部切换为PhantomJS Webdriver。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.