The Problem
In Chrome, I'm attempting to select a search button via a Selenium method in Python and have the new content load on the same tab without opening in a new tab. However, when running through Selenium methods, the content always loads in a new tab. When operating as a human user, the button click always results in the new content loading on the same page.
EDIT: The URL (for reference, and since I'm not very good at using the Chrome dev tools to debug Javascript) is https://glassdoor.com. This is for a personal development project, in case anyone is curious.
What I've Tried
This is in Python 2.7.16 with the Selenium Webdriver module. I have tested the following methods on this button:
.click()
.sendKeys(Keys.ENTER)
I've also tried WebDriverWait(driver, X.0) prior to selecting the button to accommodate for DOM refreshes.
I am 90% certain that this is behaving the way it is because the search button doesn't receive a target until after it has been pressed by the user. The target link is generated through a Javascript function that builds the link based off of the keywords.
Additionally, this is the only thread I could find where a similar question was asked. Unfortunately, that person had a target property they could manipulate.
The Code
The current Python code/Selenium method to click the button:
#The .click() and .send_keys(Keys.ENTER) methods work the same from my experience
chromeDriver.find_element_by_id("HeroSearchButton").send_keys(Keys.ENTER)
HTML as seen in Chrome Console:
<button class="gd-btn-mkt" id="HeroSearchButton" type="submit" tabindex="0"><span>Search</span></button>
::before
<span>Search</span>
::after
</button>