我正在使用 Selenium Firefox Web 驱动程序。它工作正常,但是当我使用“dotnet run”在命令行中工作时,命令行上出现了一些我没有解决的警告日志。我该如何解决这个问题?
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)
...是启用 Webrender 时 StdOut
被 C:\fakepath
发送垃圾邮件的结果。
分析
当在启用 WebRender 的情况下打开 Firefox 时,如果捕获了 stdout
,则会观察到警告
消息。这些警告
消息是GPU -> ANGLE
模块中WebRender中的一些着色器更改的结果。
我们在以下主题中详分割析和讨论了这个问题:
- Mozilla - Bugzilla:StdOut is spammed with 'C:\fakepath' when Webrender is enabled
- Chromium - 错误:Issue 765576: WARNING:angle_platform_impl.cc(51)
解决方案
确保:
- 将 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()
来关闭和销毁 WebDriver 和 Web Client 优雅地实例化。
关于c# - StdOut 充斥着 'C:\fakepath' 警告,整数除法可能会慢得多,如果可能,请尝试使用 uints 通过 C# 使用 Selenium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59677545/