c# - StdOut 充斥着 'C:\fakepath' 警告,整数除法可能会慢得多,如果可能,请尝试使用 uints 通过 C# 使用 Selenium

标签 c# selenium selenium-chromedriver selenium-firefoxdriver renderer

我正在使用 Selenium Firefox Web 驱动程序。它工作正常,但是当我使用“dotnet run”在命令行中工作时,命令行上出现了一些我没有解决的警告日志。我该如何解决这个问题?

console warning logs

var options = new FirefoxOptions();
            options.AddArguments("--headless");
            IWebDriver driver = new FirefoxDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);
            var link = "ANY LINK";

            driver.Navigate().GoToUrl(link);
            driver.FindElement(By.ClassName("ANY CLASS NAME")).Click(); 
            driver.Dispose();

这是由于图像链接损坏而出现的一些警告

1578640820834   <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4726232328293469302225223f332229342e282969342435222229342f283334072a283d2e2b2b2669283520" rel="noreferrer noopener nofollow">[email protected]</a>     WARN    Loading extension '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4330203126262d302b2c3730032e2c392a2f2f226d2c3124" rel="noreferrer noopener nofollow">[email protected]</a>': Reading manifest: Invalid extension permission: mozillaAddons
1578640820834   <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6b0a0f0f040518451c0e090e131f0e0518020405451808190e0e051803041f182b0604110207070a4504190c" rel="noreferrer noopener nofollow">[email protected]</a>     WARN    Loading extension '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5320302136363d203b3c2720133e3c293a3f3f327d3c2134" rel="noreferrer noopener nofollow">[email protected]</a>': Reading manifest: Invalid extension permission: telemetry
1578640820834   <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6c0d080803021f421b090e09141809021f050302421f0f1e0909021f0403181f2c0103160500000d42031e0b" rel="noreferrer noopener nofollow">[email protected]</a>     WARN    Loading extension '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="5122322334343f22393e2522113c3e2b383d3d307f3e2336" rel="noreferrer noopener nofollow">[email protected]</a>': Reading manifest: Invalid extension permission: resource://pdf.js/
1578640820834   <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="214045454e4f520f564443445955444f52484e4f0f52425344444f52494e5552614c4e5b484d4d400f4e5346" rel="noreferrer noopener nofollow">[email protected]</a>     WARN    Loading extension '<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d7a4b4a5b2b2b9a4bfb8a3a497bab8adbebbbbb6f9b8a5b0" rel="noreferrer noopener nofollow">[email protected]</a>': Reading manifest: Invalid extension permission: about:reader*
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
WARN: compileToBinary(259):
C:\fakepath(337,18-133): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(343,62-116): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(360,75-84): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(363,50-59): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\fakepath(383,33-90): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(174,1-6): warning X4000: use of potentially uninitialized variable (dyn_index_vec4_float4)
C:\fakepath(289,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

WARN: compileToBinary(259):
C:\fakepath(337,18-133): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(343,62-116): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(360,75-84): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(363,50-59): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\fakepath(383,33-90): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(174,1-6): warning X4000: use of potentially uninitialized variable (dyn_index_vec4_float4)
C:\fakepath(289,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.

WARN: compileToBinary(259):
C:\fakepath(360,75-84): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(363,50-59): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\fakepath(174,1-6): warning X4000: use of potentially uninitialized variable (dyn_index_vec4_float4)
C:\fakepath(225,1): warning X4000: use of potentially uninitialized variable (f_distance_aa)
C:\fakepath(262,1): warning X4000: use of potentially uninitialized variable (f_do_clip)

[Child 7840, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Ch1578640823372        Marionette      INFO    Listening on port 58853
1578640829566   Marionette      INFO    Stopped listening on port 58853
[Parent 18380, Gecko_IOThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[Child 23108, Chrome_ChildThread] WARNING: pipe error: 109: file z:/task_1572401533/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 341
[GPU
###!!! [Child][RunMessage] Error: Channel closing: too late to send/recv, messages will be lost

最佳答案

这些警告消息...

WARN: compileToBinary(259):
C:\fakepath(337,18-133): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(343,62-116): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(360,75-84): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(363,50-59): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\fakepath(383,33-90): warning X3571: pow(f, e) will not work for negative f, use abs(f) or conditionally handle negative values if you expect them
C:\fakepath(174,1-6): warning X4000: use of potentially uninitialized variable (dyn_index_vec4_float4)
C:\fakepath(289,25-29): error X4576: Input array signature parameter  cannot be indexed dynamically.
.
WARN: compileToBinary(259):
C:\fakepath(360,75-84): warning X3556: integer divides may be much slower, try using uints if possible.
C:\fakepath(363,50-59): warning X3556: integer modulus may be much slower, try using uints if possible.
C:\fakepath(174,1-6): warning X4000: use of potentially uninitialized variable (dyn_index_vec4_float4)
C:\fakepath(225,1): warning X4000: use of potentially uninitialized variable (f_distance_aa)
C:\fakepath(262,1): warning X4000: use of potentially uninitialized variable (f_do_clip)

...是启用 WebrenderStdOutC:\fakepath 发送垃圾邮件的结果。


分析

当在启用 WebRender 的情况下打开 Firefox 时,如果捕获了 stdout,则会观察到警告消息。这些警告消息是GPU -> ANGLE模块中WebRender中的一些着色器更改的结果。

我们在以下主题中详分割析和讨论了这个问题:

最后通过这个merge解决了这个问题/commit


解决方案

确保:

  • JDK 升级到最新级别 JDK 8u222 .
  • Selenium升级到当前级别 Version 3.141.59 .
  • 将 GeckoDriver 升级至 GeckoDriver v0.26.0级别。
  • GeckoDriver 位于所需位置。
  • GeckoDriver 对非 root 用户具有可执行权限。
  • Firefox 版本升级至 Firefox v70.0 级别。
  • 通过 IDE清理您的项目工作区,并仅使用所需的依赖项重建项目。
  • (仅限 WindowsOS)使用 CCleaner工具可以清除执行测试套件之前和之后的所有操作系统杂务。
  • (仅限 LinuxOS)Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint执行测试套件之前和之后。
  • 如果您的基本网络客户端版本太旧,请通过 Revo Uninstaller 卸载它并安装最新的 GA 和已发布版本的Web 客户端
  • 重新启动系统
  • 以非 root 用户身份执行测试
  • 始终在 tearDown(){} 方法中调用 driver.quit() 来关闭和销毁 WebDriverWeb Client 优雅地实例化。

关于c# - StdOut 充斥着 'C:\fakepath' 警告,整数除法可能会慢得多,如果可能,请尝试使用 uints 通过 C# 使用 Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59677545/

相关文章:

java - 使用 Java 和 ImageMagick 比较两个图像时出现问题

c# - Selenium 在 Chrome 版本 32.0.1700.72 m 中失败

c# - 服务器上的 MSBuild 错误CS0234 错误 .net 4.7.2

java - 尝试在 TestNG 中使用 ExtentReports 生成测试报告时获取 NullPointerException

java - Maven 使用关键字 "Test"运行所有测试

google-chrome - centos 6.5 上的 chromedriver 无法运行

c# - 仅在一个类中设置泛型类型

c# - 在 Visual Studio IDE 中从 XSD 自动生成 C#

c# - 我的自定义InputStream 和outputStream 对象可以在C# HTTP 程序中工作吗?

selenium - 与 Java ChromeOptions.setExperimentalOptions() 等效的 C# 是什么?