pythonselenium-webdriverautomationmetamask

Runtime.evaluate threw exception: Error: LavaMoat - property "ads_adoQpoasnfa76pfcZLmcfl_Promise" of globalThis is inaccessible under scuttling mode


chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/notification.html#unlock I am trying to automate metamask by using a simple script with selenium. The problem is that an exception is being thrown when I'm trying to get the title of the tab after I've opened metamask.

I'm using selenium version 4.11.2,
python version 3.11.4,
Windows 10

url = "http://local.adspower.net:50325/api/v1/browser/start?user_id=" + ads_id

response = requests.get(url).json()

service = Service(executable_path=response["data"]["webdriver"])
chrome_options = Options()
chrome_options.add_extension(EXTENSION_PATH)
chrome_options.add_experimental_option("debuggerAddress", response["data"]["ws"]["selenium"])
driver = webdriver.Chrome(options=chrome_options, service=service)
driver.maximize_window()
time.sleep(10)
#exception gets thrown here
print(driver.title)
Message: unknown error: Runtime.evaluate threw exception: Error: LavaMoat - property "ads_adoQpoasnfa76pfcZLmcfl_Promise" of globalThis is inaccessible under scuttling mode. To learn more visit https://github.com/LavaMoat/LavaMoat/pull/360.
  at get (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/runtime-lavamoat.js:11632:17)
  at callFunction (<anonymous>:443:26)
  at e.<computed> (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sentry-install.js:1:693)
  at <anonymous>:460:23
  at e.<computed> (chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sentry-install.js:1:693)
  at <anonymous>:461:3
  (Session info: chrome=108.0.5359.72)

Also, this happens with other things like finding/clicking elements on metamask.

There is a similar post to this: Runtime.callFunctionOn threw exception: Error: LavaMoat - property "Proxy" of globalThis is inaccessible under scuttling mode My situation is different because I'm using an antidetect browser + proxy called ADSPower - not the regular Google Chrome. To access the browser I'm using requests with the ADSPower API.

I know that the problem is coming from ADSPower because my script works when I'm trying to scrape meatamask on a regular Chrome webdriver - I can get the title/find and click elements, which is weird, considering that the other post was about a problem regarding scraping metamask using a regular browser.

Also, the exception specifies a property that I haven't seen before that should be related to the ADSPower browser "ads_adoQpoasnfa76pfcZLmcfl_Promise". The browser name and version: SunBrowser 112.0.5615.138.


Solution

  • you almost found the solution) it was in question: Having this error : Message: unknown error: Runtime.callFunctionOn threw exception: Error: LavaMoat - property "JSON"

    Two way for fix: First is to rebuilding and reinstaling metamask pugins to all your profile with set lavamoat to off, it may cause all data to be reset and wallets need to be re-imported. If it is suitable, then this method has been tested on the latest version of metamask - everything works.

    Second: If you want to save all the data, you need to go to the .ADSPOWER_GLOBAL folder, it is usually hidden, so first enable the display of hidden files and go to the root of the disk where AdsPower was installed. Next, the first action is to find all runtime-lavamoat.js files in the extensions folder(inside all internal folders) and disable the use of lavamoat there as shown in the picked link to question. (this is for new profile that will use metamask) Next, you need to do the same for each profile, that is, go to the cache(.ADSPOWER_GLOBAL\cache) folder and search for runtime-lavamoat.js files in all internal folder and disable it use also there (this is for account that already use metamask).