undetected-chromedriver
undetected-chromedriver copied to clipboard
[nodriver] headless=True gets detected
First of all thank you for the great package. It works fine, if headless = False but when switch to headless=True, it gets detected. Any guidance to address this? Tested @ s a h i b i n d e n dot c o m
First of all thank you for the great package.
It works fine, if headless = False but when switch to headless=True, it gets detected.
Any guidance to address this?
Tested @ s a h i b i n d e n dot c o m
Some websites have stronger detection algorithms so when running headless you are more likely to get detected.
As a workaround, you can use a virtual display and run non-headless to get similar functionality but at a cost of more computational power.
I got the same issue since the last month, as headless mode gets detected so I worked around it using a virtual display.
from pyvirtualdisplay import Display
display = Display(visible=0, size=(800,600))
display.start()
Having said that, if you are using a linux vps you will need xvfb package. Hope this helps.
@Wajih-Wanis can you elaborate more on this method? I'd like to implement it in my code but I don't quite get how I can continue after display.start(), is it supposed to replace nodriver.start()?
Same issue for me.
@Wajih-Wanis How the virtual display worked in code? Could you please provide a example?
use --headless=chrome
@Wajih-Wanis can you elaborate more on this method? I'd like to implement it in my code but I don't quite get how I can continue after display.start(), is it supposed to replace nodriver.start()?
from pyvirtualdisplay import Display display = Display(visible=0, size=(1080,720)) display.start() #Have your code here display.stop()
@Wajih-Wanis can you elaborate more on this method? I'd like to implement it in my code but I don't quite get how I can continue after display.start(), is it supposed to replace nodriver.start()?
This code snippet should wrap your whole automation process. Write your code as if it going to run in normal mode ( not headless ) and add those at the start of the code. It will run in non headless but it will not have any visible display.
@Wajih-Wanis can you elaborate more on this method? I'd like to implement it in my code but I don't quite get how I can continue after display.start(), is it supposed to replace nodriver.start()?
This code snippet should wrap your whole automation process. Write your code as if it going to run in normal mode ( not headless ) and add those at the start of the code. It will run in non headless but it will not have any visible display.
not working with some more arguments??? browser = await display.start(browser_args=[f"--proxy-server={PROXY}"], headless=False) error