-1

How can I use "sendkeys" or find new elements in a new opened browser window and return back to my old window?

Here is the code I have so far:

DesiredCapabilities EQcapabilities = new DesiredCapabilities();

EQcapabilities.SetCapability("appTopLevelWindow", EQWindowHandle);

var EQSession = new WindowsDriver<WindowsElement>(
    new Uri("http://127.0.0.1:4723"), EQcapabilities);


// new window:
EQSession.FindElementByName("...").Click();

// I have tried this, but it is not working

String newWindowHandle = EQSession.WindowHandles.Last();
var newWindow = EQSession.SwitchTo().Window(newWindowHandle);
newWindow.sendkeys("some text");
CharonX
  • 2,130
  • 11
  • 33

1 Answers1

0

You're sending the keys to the window. Find the element that you want to send them to first, and use SendKeys on that.

brandonwc5
  • 11
  • 1
  • Also, keep your previous window handle in memory, so you can switch back to it after you finished doing whatever you wanted to do in that explorer window. – PixelPlex Aug 09 '19 at 12:08