硒可及性测试

我已经下载了最新的 rcx 文件并在 chrome 选项中添加了扩展名。


第一步执行得很好。在第二步中,它一直执行到 driver.Navigate().GoToUrl("chrome://extensions-frame/");


对于下一步,它会引发此错误


"OpenQA.Selenium.NoSuchElementException

HResult=0x80131500

Message=no such element: Unable to locate element: {"method":"xpath","selector":"//a[@class='extension-commands-config']"}

(Session info: chrome=68.0.3440.106)

(Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64)

Source=WebDriver

StackTrace:

at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)

at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)

at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)

at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByXPath(String xpath)

at OpenQA.Selenium.By.<>c__DisplayClass19_0.<xpath>b__0(ISearchContext context)

at OpenQA.Selenium.By.FindElement(ISearchContext context)

at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)

at Exsilio.QA.Test.DKNAccessabilityTest.AccessabilityTest() in C:\Trilok\Projects\Code\Automation Testing\RealTimeDataUpdate\QualityAssurance\Exsilio.QA.Test\DKNAccessabilityTest.cs:line 40"

我使用“extension_1_0_9_0.crx”作为当前扩展。


请做充分的需要。



慕哥9229398
浏览 129回答 2
2回答

人到中年有点甜

对于问题中的任何行的答案,我使用的是带有 WAVE 扩展名的那些行,这就是问题所在。我没有尝试过用Wave实现这一点的方法。它不适用于Wave只会为您提供错误的快照。从快照中,您将无法获得诸如错误或缺陷类型之类的想法。我建议不要为辅助功能测试使用 WAVE 扩展。而不是使用工具“ Globant.Selenium.Axe ”。使用Nuget 包管理器安装插件这是Chrome 扩展程序的链接。这是在文本文件中记录错误的代码:&nbsp;//If file does not exists, Create a new file and log the result.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!File.Exists(accessiblityTestFileLocation))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File.Create(accessiblityTestFileLocation).Dispose();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LogResult ();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //If file exists, Log the result into file.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else if (File.Exists(accessiblityTestFileLocation))&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; LogResult ();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }日志结果函数:&nbsp; &nbsp;public void LogResult ()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp;using (StreamWriter sw = new StreamWriter(accessiblityTestFileLocation))&nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var path in appInfo.Pages)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var navigateUrl = new Uri(baseUrl, path.Path);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; driver.Navigate().GoToUrl(navigateUrl);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; driverService.driver.Manage().Window.Maximize();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; AxeResult results = driver.Analyze();&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Format the results, And write them in the text file.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (results.Passes.Length > 0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Format the text as per your need, This text will be entered into the Text file.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("\n");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine(path.Title);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("===========================");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("\n");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var passCase in results.Passes)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Id: " + passCase.Id);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Description: " + passCase.Description);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Impact: " + "Normal");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Help: " + passCase.Help);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("HelpURL: " + passCase.HelpUrl);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var node in passCase.Nodes)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine(node.Html);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("\n");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Format the results based on the result type, And write them in the text file.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (results.Violations.Length > 0)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var violation in results.Violations)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Write the accessibility test for the selected Attributes provided by the Axecore.&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Id: " + violation.Id);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Description: " + violation.Description);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Impact: " + violation.Impact);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("Help: " + violation.Help);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("HelpURL: " + violation.HelpUrl);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach (var node in violation.Nodes)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine(node.Html);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sw.WriteLine("\n");&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; }&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }

长风秋雁

2件事。他们已移动链接以启用 Chrome 插件的快捷键。您甚至可以通过手动切换其中任何一个来查看这一点。该选项仍然可用@ chrome://extensions,但它不再位于页面底部,而是用户 id=menuButton。我还认为,即使您启用了该选项,您在将 CTRL+m 发送到浏览器时也会遇到问题。
打开App,查看更多内容
随时随地看视频慕课网APP