Giter Site home page Giter Site logo

elmasekar / python-selenium-tunnel Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 5.0 1 KB

A sample repo to help you start tunnel for automation test in Python-selenium on LambdaTest. Run your automation test python scripts on Lambdatest.

Home Page: https://www.lambdatest.com/selenium-automation/?utm_source=github&utm_medium=about&utm_campaign=python-selenium-tunnel

Python 100.00%
python-selenium python-selenium-tunnel selenium-tunnel automation automation-selenium automation-test automation-testing lambdatest localhost localhost-tunnel

python-selenium-tunnel's Introduction

How to start tunnel for automation test in Python-selenium on LambdaTest

If you want to run your an automation test in Python-selenium on LambdaTest using the tunnel and want to start the tunnel automatically in the script, you can use the follwing steps. You can refer to sample test repo here.

Steps

Step 1: Download the LT tunnel binary from LT Dashboard

Go to your LambdaTest dashboard and click the configure tunnel button on the top right corner and use the download link to download the binary file.

Step 2: Code to run LT tunnel before test

The tunnel should be started before test case execution and end after completion. To achieve this, tunnel can be started in the main function like so:

import subprocess

if __name__ == "__main__":

    #start tunnel process
    tunnel_process = subprocess.Popen(["./LT","--user",username,"--key",access_key],stdout=subprocess.DEVNULL,stderr=subprocess.STDOUT)
    
    #run testcases
    unittest.main()

    #end tunnel
    tunnel_process.terminate()

Step 3: Set tunnel capability to True

Add the "tunnel": True capability in your test file:

desired_caps = {
            'LT:Options': {
                "build": "Python Demo",  # Change your build name here
                "name": "Python Demo Test",  # Change your test name here
                "platformName": "Windows 11",
                "selenium_version": "4.0.0",
                "tunnel": True
            },
            "browserName": "Chrome",
            "browserVersion": "98.0",
        }

Step 4: Run your test

python lambdatest.py

Links:

LambdaTest Community

python-selenium-tunnel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.