After receiving assistance from engineering, I have made some modifications to my code for grabbing the new window handle. Here is the final version:
localdriver = @driver
@driver.getAllWindowHandles()
.then (handles) ->
localdriver.switchTo().window(handles[1])
Currently, I am using a stack of automation tools that includes Selenium Webdriver, Mocha, Chai, and Grunt. My scripts are in Coffeescript, but I am open to solutions in Javascript as well.
The objective I'm aiming for is as follows:
- Click on a button in the main browser window
- Switch the driver to the second window that appears after clicking the button
- Execute actions in the second window
- Close the second window and return to the first one
I've been searching online for guidance on how to achieve this task. I started learning all these technologies just a few months ago, so I'm still navigating through the process of creating scripts. While I see many examples in Java and C++, there isn't as much in Javascript. Can someone provide an illustration of how to set up the code for the above scenario using Selenium Webdriver and Javascript?