wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

SeleniumWire Unable to Intercept Network with Samsung S23 android user-agent #729

Open Anirban-Patra-OFC opened 7 months ago

Anirban-Patra-OFC commented 7 months ago

The chromedriver is initiated but in the network tab only images and png are shown.The XHR/Fetch is empty. image

Please keep your credentials ready for the creation of chrome profiles. What might be the reason of this issue?Please guide me to correct the problem.


from seleniumwire import webdriver
from selenium.webdriver.chrome.options import Options
opt_sw = {'enable-har':True}

options = Options()
samsung_s23_ultra = '''Mozilla/5.0 (Linux; Android 13; SAMSUNG SM-S918B) AppleWebKit/537.36 (KHTML, like Gecko)SamsungBrowser/21.0 Chrome/110.0.5481.154 Mobile Safari/537.36'''
mob_user_agent = '''Mozilla/5.0 (Linux; Android 11.0; SAMSUNG SM-G925I Build/NRD90M) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/7.4 Chrome/107.0.5304.105 Mobile Safari/537.36'''

options.add_argument(f'user-agent={samsung_s23_ultra}')

profile_path = r"user-data-dir=C:\Users\USER\AppData\Local\Google\Chrome\User Data\fb_Profile"
options.add_argument(profile_path)

options.add_experimental_option("useAutomationExtension", False)
options.add_experimental_option("excludeSwitches",["enable-automation"])
options.add_experimental_option('prefs', {
    'profile.default_content_setting_values.notifications': 1,
    'profile.default_content_setting_values.clipboard': 1
})
options.add_argument("window-size=600,880")

driver = webdriver.Chrome(options=options)
time.sleep(10)
driver.get('https://www.facebook.com/')