I'm working with Selenium Automation. In this, When i click a link in a current window, a new window opens. I just want to switch the control to the new window. But i can't do this.Actually the new window is an auto-generated one. That is, link will be generated dynamically. Help me friends...
相关问题
- Delete Messages from a Topic in Apache Kafka
- Jackson Deserialization not calling deserialize on
- How to maintain order of key-value in DataFrame sa
- StackExchange API - Deserialize Date in JSON Respo
- Difference between Types.INTEGER and Types.NULL in
Yes this is possible. First you need to save the refrence to current window.
The after having clicked the link, you need to switch to the other window.
This is where you perform operations on new window, finally closing it with
and switch back to parent window
To switch between windows we have method.
To get the different windows handle, we have method.
Example:
I finally found the answer, I used the below method to switch to the new window,
To move to parent window, i used the following code,
In an excerpt from a getting started with selenium webdriver project on github,
These are 2 custom functions to help you get started. Or you can check out that project from github to make your selenium projects better designed and easier.
These functions can switch to, or wait for (if it doesn't exist) a window with a certain title / url.