Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium Webdriver C# Sendkeys (Keys.Arrowdown)

I'm trying to do do an arrow using Selenium Webdriver/C# compile but when I try to compile I get this error:

'Keys' is an ambiguous reference between 'OpenQA.Selenium.Keys' and 'System.Windows.Forms.Keys' (CS0104)

My code:

driver.FindElement(By.Id("ctl00_PlaceHolderMain_ctrlChangeBillingAddress_ctrlChangeBillingAddress_txtBillingAddress")).SendKeys(Keys.ArrowDown);
driver.FindElement(By.Id("ctl00_PlaceHolderMain_ctrlChangeBillingAddress_ctrlChangeBillingAddress_txtBillingAddress")).SendKeys(Keys.Enter);
like image 820
automationguy Avatar asked Jun 03 '12 03:06

automationguy


1 Answers

I can provide you two realizations, but the first one works only locally:

  1. Element.SendKeys(OpenQA.Selenium.Keys.ArrowUp);

  2. char c = '\uE013'; // ASCII code ArrowUp

    Element.SendKeys(Convert.ToString(c));

like image 115
user2742238 Avatar answered Oct 27 '22 18:10

user2742238