I'm trying to get to a Dapp that needs Metamask extension to access it. I added it through chrome extension. I know how to add the extension to the chrome instance in selenium but I don't know how to add a password etc..Could anyone download Metamask and give me an example of how I could pass credentials through selenium using it?
ChromeOptions options = new ChromeOptions();
options.addArguments("--start-maximized");
options.addExtensions(newFile("//Applications//chrome//MetaMask_v3.13.8.crx"));
driver = new ChromeDriver(options);
Due to rather complex process of wallet info input in Metamask, it seems like the best way to get your test to work with Metamask extension is to start Chrome with defined profile directory use preconfigured Chrome profile:
# google-chrome -user-data-dir=/tmp/profile
then add Metamask extension and configure your wallet manually, and then add the correspondent argument to WebDriver options to use this profile instead of creating an empty one:
options.addArguments("user-data-dir=/tmp/profile");
Then, in test, you'll have to re-enter the Metamask's password and you'll all set.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With