我有一个textarea,我需要在那里输入完整的HTML。
在BDD我将传递文件的路径,但我不知道如何捕获完整的HTML(带标签)以通过SendKeys应用于Textarea。
我正在使用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。
只需阅读内容,然后将其传递到文本区域,在步骤def中。
string fullHtml = File.ReadAllText(file);
char tab = '\u0009';
fullHtml = fullHtml.Replace(tab.ToString(), "");
driver.FindElement(By.Id("TxtConteudo")).SendKeys(fullHtml);