Giter VIP home page Giter VIP logo

obnoxiousish / selenium_metamask_automation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from javerianadeem/selenium_metamask_automation

0.0 0.0 0.0 62.75 MB

Multiple patchs applied to repo to make it work again

License: MIT License

Shell 0.01% JavaScript 0.09% C++ 0.38% Python 98.24% C 0.03% PowerShell 0.11% XSLT 0.01% CSS 0.49% TeX 0.04% HTML 0.54% Batchfile 0.01% Roff 0.04% VBScript 0.01% Classic ASP 0.01%

selenium_metamask_automation's Introduction

Introduction

This package is created to automate metamask wallet extension using selenium webdriver.

To Install The Package:

pip install ./selenium_metamask_automation

or

pip install -i https://test.pypi.org/simple/ selenium-metamask-automation

Check if the package exists

pip list

Functions

1. To download the extension:

selenium_metamask_automation.downloadMetamaskExtension()

This function has to be run once before all functions to download the metamask extension. If you change the directory or create your python file somewhere else, this needs to be run first otherwise following exception will be thrown:

“Path to extension does not exist”

2. To launch the extension use the function below

selenium_metamask_automation.launchMetamaskExtension(args)

args: path to chrome webdriver

This function returns a value which contains the driver. You can retrieve it like:

driver = launchSeleniumWebdriver(r‘C:\Drivers\chromedriver_win32\chromedriver.exe’)

Now use can call any selenium method using this driver variable

driver.get("https://google.com")

3. To import wallet

selenium_metamask_automation.metamaskSetup(arg1, arg2)

arg1 : seed phrase of wallet arg2: password of wallet

4. To Change the metamask Network:

selenium_metamask_automation.changeMetamaskNetwork(arg)

arg: network name

The network names are mentioned below. On selecting any other network, it will throw an error.

  • Ethereum Mainnet
  • Ropsten Test Network
  • Kovan Test Network
  • Rinkeby Test Network
  • Goerli Test Network

4. To connect to any website use the function below:

selenium_metamask_automation.connectToWebsite()

In order to use this function, you have to visit the website first

driver.get("https://google.com")
selenium_metamask_automatiom.connectToWebsite()

6. For approval transactions:

Confirm:

selenium_metamask_automation.confirmApprovalFromMetamask()

Reject:

selenium_metamask_automation.rejectApprovalFromMetamask()

7. For transactions other than approval:

Confirm:

selenium_metamask_automation.confirmTransactionFromMetamask()

Reject:

selenium_metamask_automation.rejectTransactionFromMetamask()

8. To add token in your metamask wallet:

selenium_metamask_automation.addToken(arg)

arg: contract address of token

9. Sign:

signConfirm:

selenium_metamask_automation.signConfirm()

signReject:

selenium_metamask_automation.signReject()

Errors you might face:

pip list shows the package “selenium_metamask_automation” but your IDE does not detect the package

Solution:

Go to IDE settings > Python Interpreter

Change the path to C://ProgramFiles//Python//python.exe or in your case add the path where python.exe is installed

selenium_metamask_automation's People

Contributors

javerianadeem avatar vblackout avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.