Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Suggest idea with edge automation (Detected me as Bot) #2566

slvamegestic started this conversation in Ideas
Discussion options

Hi, not like to create duplicates just wanted to ask you about edge browser behavior to bypass the bot detection.

from seleniumbase import SB,Driver
from selenium import webdriver
from msedge.selenium_tools import Edge, EdgeOptions
import time
sb_config={}
sb_config['browser']='edge'
sb_config['uc']=True
sb_config['undetectable']= True
edge_options = EdgeOptions()
edge_options.use_chromium = True
edge_options.add_experimental_option("useAutomationExtension", False)
edge_options.add_experimental_option("excludeSwitches", ["enable-automation", "enable-logging"])
sb_config['cap_string'] = edge_options.to_capabilities()
 with SB(**sb_config) as sb:
 try:
 sb.driver.get("https://www.browserscan.net/en/bot-detection")
 #sb.driver.uc_open_with_reconnect("https://www.browserscan.net/en/bot-detection")
 sb.sleep(10)
 finally:
 sb.sleep(2)
 sb.driver.save_screenshot('test-ss.png')
 print("Success")
 sb.driver.quit() 

This code for edge has been detected as a bot. I have searched everywhere but do not have any idea how to create a good profile in microsoft edge. Do you have any advice/idea on this? i have tried old Edge version 70 as they have removed chrome arg command after the relaese but old version not working in seleniumbase, Edge version >80 is working but all were detected me as bot.

Screenshot 2024年03月05日 at 5 13 34 PM

As they removed chrome arg command after the release, I tried the old Edge version 70, but it didn't work in Seleniumbase, only all Edge version 80 above worked, but all were detected as bots. Selenium, CDP, and Headless Chrome were detected by the driver so all failed.

You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

Regular Edge automation is supported with --edge / browser="edge"


For avoiding bot-detection with Edge, that's a duplicate of #2547 (comment)

UC Mode is only for Chrome, Brave, and Opera.

If using Brave or Opera, set the binary_location in Driver() or SB().

On a Mac, those locations are:

Brave: binary_location="/Applications/Brave Browser.app/Contents/MacOS/Brave Browser"
Opera: binary_location="/Applications/Opera.app/Contents/MacOS/Opera"

On Windows and Linux, the locations will be different. You'll need to find the location and use it for binary_location.

You must be logged in to vote
1 reply
Comment options

That's cool that Brave and Opera work well together. However, I would like to do the same for msedgedriver in my case.

Even after replacing and removing the below flags in the driver and also replacing $cdc_singature, msedge became conflicted.

  1. Could you suggest how to remove/replace those flags in seleniumbase msedge driver without conflicting with the driver and how the driver detects browsers controlled by selenium?
 "__webdriver_evaluate",
 "__selenium_evaluate",
 "__webdriver_script_function",
 "__webdriver_script_func",
 "__webdriver_script_fn",
 "__fxdriver_evaluate",
 "__driver_unwrapped",
 "__webdriver_unwrapped",
 "__driver_evaluate",
 "__selenium_unwrapped",
 "__fxdriver_unwrapped",
 ...

My driver does not appear to be receiving edge capabilities from previous code,see below

edge_options = EdgeOptions()
edge_options.use_chromium = True
edge_options.add_argument("--disable-extensions")
sb_config['extension_dir']= my_extension_dir
sb_config['cap_string'] = edge_options.to_capabilities()
with SB(**sb_config) as sb:

Surely --disable-extensions should disable the extension if it's for --disable-extensions? Although my extension got working with the above code, it was not disabled.
2) How can i exactly assign edge capabilities to my driver?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /