亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

硒可及性測試

硒可及性測試

C#
慕哥9229398 2021-12-25 16:36:54
我已經下載了最新的 rcx 文件并在 chrome 選項中添加了擴展名。第一步執行得很好。在第二步中,它一直執行到 driver.Navigate().GoToUrl("chrome://extensions-frame/");對于下一步,它會引發此錯誤"OpenQA.Selenium.NoSuchElementExceptionHResult=0x80131500Message=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=WebDriverStackTrace: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”作為當前擴展。請做充分的需要。
查看完整描述

2 回答

?
人到中年有點甜

TA貢獻1895條經驗 獲得超7個贊

對于問題中的任何行的答案,我使用的是帶有 WAVE 擴展名的那些行,這就是問題所在。


我沒有嘗試過用Wave實現這一點的方法。它不適用于Wave只會為您提供錯誤的快照。


從快照中,您將無法獲得諸如錯誤或缺陷類型之類的想法。我建議不要為輔助功能測試使用 WAVE 擴展。而不是使用工具“ Globant.Selenium.Axe ”。使用Nuget 包管理器安裝插件


這是Chrome 擴展程序的鏈接。


這是在文本文件中記錄錯誤的代碼:


 //If file does not exists, Create a new file and log the result.

            if (!File.Exists(accessiblityTestFileLocation))

            {

                File.Create(accessiblityTestFileLocation).Dispose();

                LogResult ();

            }

            //If file exists, Log the result into file.

            else if (File.Exists(accessiblityTestFileLocation))

            {

                LogResult ();

            }

日志結果函數:


   public void LogResult ()

                {


     using (StreamWriter sw = new StreamWriter(accessiblityTestFileLocation))

        {

            foreach (var path in appInfo.Pages)

            {

                var navigateUrl = new Uri(baseUrl, path.Path);


                driver.Navigate().GoToUrl(navigateUrl);

                driverService.driver.Manage().Window.Maximize();


                AxeResult results = driver.Analyze();


                //Format the results, And write them in the text file.

                if (results.Passes.Length > 0)

                {

                    //Format the text as per your need, This text will be entered into the Text file.

                    sw.WriteLine("\n");

                    sw.WriteLine(path.Title);

                    sw.WriteLine("===========================");

                    sw.WriteLine("\n");


                    foreach (var passCase in results.Passes)

                    {

                        sw.WriteLine("Id: " + passCase.Id);

                        sw.WriteLine("Description: " + passCase.Description);

                        sw.WriteLine("Impact: " + "Normal");

                        sw.WriteLine("Help: " + passCase.Help);

                        sw.WriteLine("HelpURL: " + passCase.HelpUrl);

                        foreach (var node in passCase.Nodes)

                        {

                            sw.WriteLine(node.Html);

                            sw.WriteLine("\n");

                        }

                    }

                }


                //Format the results based on the result type, And write them in the text file.

                if (results.Violations.Length > 0)

                {

                    foreach (var violation in results.Violations)

                    {

                        //Write the accessibility test for the selected Attributes provided by the Axecore.

                        sw.WriteLine("Id: " + violation.Id);

                        sw.WriteLine("Description: " + violation.Description);

                        sw.WriteLine("Impact: " + violation.Impact);

                        sw.WriteLine("Help: " + violation.Help);

                        sw.WriteLine("HelpURL: " + violation.HelpUrl);

                        foreach (var node in violation.Nodes)

                        {

                            sw.WriteLine(node.Html);

                            sw.WriteLine("\n");

                        }

                    }

                }

            }

        }

                }


查看完整回答
反對 回復 2021-12-25
?
長風秋雁

TA貢獻1757條經驗 獲得超7個贊

2件事。他們已移動鏈接以啟用 Chrome 插件的快捷鍵。您甚至可以通過手動切換其中任何一個來查看這一點。該選項仍然可用@ chrome://extensions,但它不再位于頁面底部,而是用戶 id=menuButton。

我還認為,即使您啟用了該選項,您在將 CTRL+m 發送到瀏覽器時也會遇到問題。


查看完整回答
反對 回復 2021-12-25
  • 2 回答
  • 0 關注
  • 155 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號