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

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

使用 Selenium 在 textArea 中輸入完整的 html

使用 Selenium 在 textArea 中輸入完整的 html

C#
慕碼人8056858 2022-11-22 16:27:41
我有一個文本區域,我需要在那里輸入完整的 HTML。在 BDD,我將傳遞文件的路徑,但我不知道如何捕獲完整的 HTML(帶有標簽)以通過 SendKeys 應用于文本區域。我使用 Specflow + Selenium + C#Scenario Outline: Input Disclaimer Filme  Given I choose the type of disclaymer <type>  When I open the html file <file>  Then I send then   Examples:    | type               | file                                  |     |    "Cota Capital"  |   "C:\Disclaimers\CotaCapital.html"   |        |    "Caucionamento" |   "C:\Disclaimers\Caucionamento.html" |   方法內部:driver.FindElement(By.Id("TxtConteudo")).SendKeys(fullHtml);我想打開文件,讀取所有 html,將其保存在某個 var / string 中,然后將其傳遞給 textArea。
查看完整描述

1 回答

?
墨色風雨

TA貢獻1853條經驗 獲得超6個贊

只需閱讀內容,然后將其傳遞到文本區域,在您的步驟定義中。


string fullHtml = File.ReadAllText(file);

char tab = '\u0009';

fullHtml = fullHtml.Replace(tab.ToString(), "");

driver.FindElement(By.Id("TxtConteudo")).SendKeys(fullHtml);


查看完整回答
反對 回復 2022-11-22
  • 1 回答
  • 0 關注
  • 153 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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