Hi~!!
I was wondering if it was possible to change the UserAgent in the mobile web chrome
So I’m testing it, but I can’t change it.
Blow my Code Please Check it And Answer~!!!
‘’’
Android Native Script
‘’’
import time
import unittest
import requests
from selenium import webdriver
from appium import webdriver
class TableSearchTest(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(
command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities={
'platformName': 'Android',
'deviceName': 'emulator-5554',
'automationName': 'Appium',
'browserName': 'Chrome',
'W3C': True,
'options': {'user-agent': 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 5 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'},
}
)
def test_search_field(self):
driver = self.driver
test = driver.execute_script("return navigator.userAgent")
print(test)
driver.get("https://google.com")
time.sleep(100)
def tearDown(self):
self.driver.quit()
================================================