0

I'm wondering if it's possible to interact with metamask using python. Here is what I've tried so far:

from selenium import webdriver
browser = webdriver.Firefox(executable_path=r'C:\geckodriver.exe')
browser.install_addon('C:\metamask.xpi', temporary=True)
browser.get('moz-extension://1384f379-3bd6-4268-8759-2f754d4f2fe4/home.html#initialize/create-password/import-with-seed-phrase')

However, when I run the project this is the result: enter image description here

The extension gets imported correctly, however the welcome page which automatically comes up when downloading the extension doesn't load. Also the get(extensionurl) doesn't load at all, it doesn't even show the extension URL that I put in the get. Does anyone know any work arounds for this?

Thank you all suggestions are appreciated!

Joshua Brown
  • 91
  • 1
  • 9

1 Answers1

0

another way to work with selenium and metamask that could spare you this problem would be to start Chrome with a defined profile that you would use in your code - please read more here

I know it's not really the answer to your question, but this actually made my life easier.

nmduarte
  • 61
  • 1
  • 6
  • That's what I tried initially, however chrome doesn't allow headless extensions. I got it to redirect to the page in chrome, however after signing into metamask it would just keep redirecting to the login. – Joshua Brown Jan 08 '22 at 18:59