如何 select 同时存在的所有值删除内容并使用 selenium c# 输入新值
How to select all value present at the same time delete the content and enter new value using selenium c#
我需要执行操作 - 双击一个元素和 select 同时存在的所有值,然后删除内容并输入新值。
下面我已经实现了相同的。它执行双击元素但不执行 Keys.Control + "a"
、删除和更改值
IWebElement AmountTextBoxElement = driver.FindElement(By.Id("id_to_find"));
Actions act= new Actions(driver);
act.DoubleClick(AmountTextBoxElement).Build().Perform();
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys(Keys.Control + "a");
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys(Keys.Delete);
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys("2323609");
您可以尝试使用 ActionBuilder
Actions action = new Actions();
action.MoveToElement(AmountTextBoxElement);
action.keyDown(Keys.CONTROL).sendKeys("A").keyUp(Keys.CONTROL).perform();
我需要执行操作 - 双击一个元素和 select 同时存在的所有值,然后删除内容并输入新值。
下面我已经实现了相同的。它执行双击元素但不执行 Keys.Control + "a"
、删除和更改值
IWebElement AmountTextBoxElement = driver.FindElement(By.Id("id_to_find"));
Actions act= new Actions(driver);
act.DoubleClick(AmountTextBoxElement).Build().Perform();
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys(Keys.Control + "a");
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys(Keys.Delete);
WaitingPeriod.SleepMedium();
AmountTextBoxElement.SendKeys("2323609");
您可以尝试使用 ActionBuilder
Actions action = new Actions();
action.MoveToElement(AmountTextBoxElement);
action.keyDown(Keys.CONTROL).sendKeys("A").keyUp(Keys.CONTROL).perform();