problematic:
My goal is to do an iteration on a result list and opening each result in a new tab, performing my tests and closing the driver related before beginning again with the next on the list. I am using a firefox webdriver on Ubuntu 18.04
I saw lot's of post similar to the one I am formulating right now but some of them date from 2014, 2015 and the answer seems to be out of date.I learned that selenium changed his policy regarding the navigation in multiple tabs. Plus,** none answer fit with a normal user behaviour. **
Here are the solutions I found on related post:
1) Use send_keys methods such as :
driver.find_element_by_tag_name("body").send_keys(Keys.CONTROL + 't')
However, it doesn't seem to be working nowadays.
2) use actionsChains with key_down and Key_up:
ActionChains(driver) \
.move_to_element(element) \
.pause(uniform(0,2)) \
.key_down(Keys.CONTROL)\
.click(element) \
.key_up(Keys.CONTROL)\
.perform()
I notice that this combo act like a right click, but it doesn't open in new tab.
Note:Both previous methods were also tried with SHIFT and COMMAND in place of CONTROL for avoiding stupid mistake.
NOTE: This method is exactly the ones for which this question is consider as "duplicate" but it is not working anymore. -> it gives exactly the same result, which is acting as a right click cf : Opening a new tab using Ctrl + click combination in Selenium Webdriver
3) Use the "execute_Script" method for open new windows with js:
new_page_url=element.get_attribute('href')
driver.execute_script("window.open('"+new_page_url+"')")
This solution work, but it is not a normal behaviour for an internet user.
Question
1) As I supposed that those two first solutions are out of date, is there any new way to open a link in a new tab by using the shortcut control and click, like could do a normal user?
2) If I am wrong, and those solutions are still available, why does it give me such unexpected behavior?