Merge pull request #2 from TJM4/master
Fixed bug where webdriver property could be detected
This commit is contained in:
commit
bf360b9808
|
@ -46,10 +46,18 @@ class Chrome:
|
||||||
"Page.addScriptToEvaluateOnNewDocument",
|
"Page.addScriptToEvaluateOnNewDocument",
|
||||||
{
|
{
|
||||||
"source": """
|
"source": """
|
||||||
Object.defineProperty(navigator, 'webdriver', {
|
Object.defineProperty(window, 'navigator', {
|
||||||
get: () => undefined
|
value: new Proxy(navigator, {
|
||||||
|
has: (target, key) => (key === 'webdriver' ? false : key in target),
|
||||||
|
get: (target, key) =>
|
||||||
|
key === 'webdriver'
|
||||||
|
? undefined
|
||||||
|
: typeof target[key] === 'function'
|
||||||
|
? target[key].bind(target)
|
||||||
|
: target[key]
|
||||||
})
|
})
|
||||||
"""
|
})
|
||||||
|
"""
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
original_user_agent_string = instance.execute_script(
|
original_user_agent_string = instance.execute_script(
|
||||||
|
|
Loading…
Reference in New Issue