How to call keys in selenium C # if there is already a project named 'Keys'?

Today I encountered a problem when I was trying to call the method SendKeys(Keys.ArrowDown) in selenium C#

I defined an IWebElement object named 'searchAddress', I was trying to use this object to call ArrowDown key and then Enter key, so I wrote two lines of code:

searchAddress.SendKeys(Keys.ArrowDown);
searchAddress.SendKeys(Keys.Enter);

Because the namespace is 'Keys', I was reminded that ArrowDown doesn't exist in the namespace 'Keys'/Enter doesn't exist in the namespace 'Keys'.

Later, I change the codes as following:

 searchAddress.SendKeys(OpenQA.Selenium.Keys.ArrowDown);
 searchAddress.SendKeys(OpenQA.Selenium.Keys.Enter);

They worked!

0 comments:

Post a Comment