Bohdan Biloshytskiy
Bohdan Biloshytskiy

Reputation: 405

Selenium response differs from browser view

I am try to use Selenium with python. Here is my snippet

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--incognito')
driver = webdriver.Chrome(options=options)
driver.get('https://www.google.com')
element = driver.switch_to_active_element()

element.send_keys('Donald Trump')
element.send_keys(Keys.RETURN)

Here is two screenshot both made in incognito mode.

Left one is controlled by selenium.

And to see right one i just copy the link from left and paste it to incognito chrome window.

Difference

Not hard to see that both windows are in incognito mode, but results are different. any idea why this can be possible? Mb i mess smthng? I am stuck with this. Looking for somebody help.

Upvotes: 0

Views: 188

Answers (2)

undetected Selenium
undetected Selenium

Reputation: 193218

The difference in snapshots says it all.

  • In the first snapshot the one generated by Selenium is a result of the Purified Search Results. In my case it is as follows :

google_search_selenium

  • In the second snapshot the one you observe is a result of the Manipulated Search Results which is produced after passing through several filters (e.g. Ad Blocker and 3 others) as follows :

Ad Blocker and 3 others

  • In my case here is the search result snapshot which is pretty much similar as follows :

google_search_user

Conclusion

When Google Search is conducted under the influence of Web Extensions and other environmental conditions search results may vary as per the prevailing conditions.

Upvotes: 0

Google has an artificial intelligence to categorize what would be most relevant to each user. For the selenium private browser, these are the most important things chosen by google. For your personal browser are other choices.

Themes such as politics, soccer team or fashion will change according to the user because everyone likes to see certain subjects, but probably themes like periodic table will not change because all users follow practically the same search flow.

Think that just having information like plugins in incognito already influences your search. Remember that you may be browsing anonymously, but you are still using the google browser, which knows a great deal about your computer and browsing choices.

Upvotes: 1

Related Questions