← Winnitude! Search  ·  Reader Mode (1330 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 54 LINKS

GitHub - sumankumar01/SeleniumWithPython: Automation with Selenium And Python

Repository navigation

SeleniumWithPython
Public

About

Automation with Selenium And Python

Topics

allure-report htmltestrunner pytest python pythonselenium selenium suitescript unittest

Resources

Readme Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks Report repository
Branches

Tags
Go to Branches page Go to Tags page

Latest commit

 

History


26 Commits
View commit history for this file.

Folders and files

Name Name Last commit message Last commit date
.idea .idea    
Report Report    
StartExecution StartExecution    
TestResourecs TestResourecs    
Utility Utility    
pageobjects pageobjects    
testcase testcase    
venv venv    
README.md README.md    

Repository files navigation

SeleniumWithPython

Automation with Selenium And Python

IDE- Pycharm

1 -> Install selenium using cmd prompt.

 C:\Users\kumar>pip install selenium
 C:\Users\kumar>pip list
          Package    Version
          ---------- -------
          pip        20.0.2
          pytz       2019.3
          selenium   3.141.0
          setuptools 41.2.0
          urllib3    1.25.9

2 -> Set the driver path

   Way 1:
     driver = webdriver.Chrome(executable_path=r"C:\Users\kumar\AppData\Local\Programs\Python\Python38-32\Scripts\chromedriver.exe")
      driver.get("http://www.newtours.demoaut.com/")
   Way 2: 
       i) Simply paste the chromedriver.exe under C:\Users\kumar\AppData\Local\Programs\Python\Python37\Scripts
       ii) Now write the simple code as below:
            driver=webdriver.Chrome()
            driver.get("http://www.newtours.demoaut.com/")    

3 -> Python unit Testing Framework

    1. Pytest
    2. Nose Test
    3. Unittest

        3 -> Html report using UnitTest and HtmlReporter

4 -> Generate allure Report. downloads the allure zip file and set the environment variable https://repo.maven.apache.org/maven2/io/qameta/allure/allure-commandline/2.10.0/ install the allure pip install allure-pytest

   import pytest

import unittest import HtmlTestRunner from HtmlTestRunner import HTMLTestRunner import allure

@allure.story('Your Story here') @allure.feature('Your Feature here') class CodeVlidation(unittest.TestCase):

@classmethod
def setUpClass(cls):
    print('Executed Before the all the method executed in class')

@classmethod
def tearDownClass(cls):
    print('xecuted after the all the method executed in class')

def setUp(self):
    print("Setup the environment")
def tearDown(self):
    print("cleaning the environment")

def testcase1(self):

    print("running the test case1")
    self.assertEqual(2, 2)

def testcase2(self):
    print("running the test case2")
    self.assertEqual(2, 3)

if name == ' main ':

testList = [CodeVlidation]
testLoad = unittest.TestLoader()

TestList = []
for testCase in testList:
    testSuite = testLoad.loadTestsFromTestCase(testCase)
    TestList.append(testSuite)

newSuite = unittest.TestSuite(TestList)
runner = unittest.TextTestRunner()
runner=HTMLTestRunner(output='example_dir')
runner.run(newSuite)

then run from cmd D:\import\UnitTestPython>python -m pytest UnitTest12345.py --alluredir ./results D:\import\UnitTestPython>allure serve ./results/
https://pythonallure.blogspot.com/

About

Automation with Selenium And Python

Topics

allure-report htmltestrunner pytest python pythonselenium selenium suitescript unittest

Resources

Readme Activity

Stars

0 stars

Watchers

1 watching

Forks

0 forks Report repository

Releases

Packages

Used by

Contributors

Languages