【发布时间】:2015-01-10 10:33:33
【问题描述】:
如何简单地在文本框中输入一个值,使用 "Ctrl+a" 从文本框中选择完整的文本,然后使用 Ctrl + c" 然后使用 Selenium + C# 将其粘贴到与 "Ctrl + v" 相同的框中。
【问题讨论】:
标签: c# selenium selenium-webdriver specflow
如何简单地在文本框中输入一个值,使用 "Ctrl+a" 从文本框中选择完整的文本,然后使用 Ctrl + c" 然后使用 Selenium + C# 将其粘贴到与 "Ctrl + v" 相同的框中。
【问题讨论】:
标签: c# selenium selenium-webdriver specflow
[FindsBy(How = How.Id, Using = "search-criteria")]
public IWebElement txtProductSearch1 = null
public void copypaste(string strCopy)
{
txtProductSearch1.Click();
txtProductSearch1.Clear();
txtProductSearch1.SendKeys(strCopy);
txtProductSearch1.SendKeys(Keys.Control + "a"); //a in smaller case
txtProductSearch1.SendKeys(Keys.Control + "c"); // c in smaller case
txtProductSearch1.Clear();
txtProductSearch1.SendKeys(Keys.Control + "v"); // v in smaller case
btnProductSearch1.Click();
}
【讨论】: