diprajpatra / selenium-stealth

Trying to make python selenium more stealthy.
MIT License
607 stars 88 forks source link

stealth causing redirection #5

Open rbecerril opened 3 years ago

rbecerril commented 3 years ago

Hi Dipraj,

I have a python crawler that I wrote using firefox and recently rewrote for chromium (running on CentOS 8). Both crawlers crawl well, so it appears they are not flagged by the website. But when I add the stealth(...) lines, the crawler first navigates to the requested website and then is redirected to a page in which all I see is a sponsored ad by google (and iframe to connect to googletagservices.com).

I looked into the potential causes. Using https://www.whatismybrowser.com/, I see no difference between what is reported with stealth() and without it.

Any insights or solutions would be greatly appreciated, as is your work on developing this tool.

thanks in advance

rafikahmed commented 3 years ago

The same thing happened to me. Still haven't figured out a solution yet.

Cooper7196 commented 2 years ago

I'm not sure what causes this issue, but I found that replacing the contents of iframe_content_window.py with the following code fixes it.

from selenium.webdriver import Chrome as Driver

def iframe_content_window(driver: Driver, **kwargs) -> None:
    pass
AlexBelanger commented 2 years ago

For those coming on this issue, it seems the changes in iframe.contentWindow.js resolved my issues of being redirected.