1
votes

How to open a new window after click on a button?

I'm searching for something like that: driver.find_element_by_css_selector('description').click_new_window()

I've tried to look at questions here on SO but nothing helped.

The point is that I want to click on a button which would open in new window because I want to save the old window with state so I can continue after look at new window.

EDIT:

HTML code of the button:

`<a href="javascript:void(0)" class="centerfloatelement nextbutton" ng-click="gotoReservation(xflight.hash + '-' + tripPair.realIndex, $parent.$index, $index, $event);"><span class="ng-binding">ġalej</span><i class="icon right">&gt;</i></a>`

Do you have any advices?

1
Could you show the HTML code of the button you want to click? Thanks. - alecxe
@alecxe I've edited the question and put the code there. - Milano

1 Answers

1
votes

Remembering the web page you are working with, one and probably the easiest option would be to click the link, extract the desired data and go back:

driver.find_element_by_css_selector('description').click()

# extract the data

driver.back()