Hello, I use selenium to click links and usually use an online application.
I'm having trouble clicking on a specific link that opens a new tab and performs an action on this newly opened tab. I have this code:
friend_link = browser.find_element_by_tag_name('a')
friend_link.click() # this is where new tab is opened
After which the webdriver (from my eyes) will open on a new tab without the need to call
browser.find_element_by_tag_name('body').send_keys(Keys.CONTROL + Keys.TAB)
So, all is well. On the webdriver tab, a new tab opens. When I try to click a link on this recently opened tab, I get a “No item” exception, that is, it cannot find the item I was looking for.
Two questions:
1) Does webdriver know that an open open tab has been opened and to perform actions on this tab? Maybe I should say that. I tried
main_window = browser.current_window_handle
browser.switch_to_window(main_window)
, .
2) , ?