HtmlTestRunner icon indicating copy to clipboard operation
HtmlTestRunner copied to clipboard

The print statements are not appearing in console

Open axvargas opened this issue 4 years ago • 0 comments

  • HtmlTestRunner version: 1.2.1
  • Python version: 3.9
  • Operating System: Windows 10

Description

I was using the library to practice test cases, but then I realize that the print statements were no appearing This is my code: ` from unittest import TestCase, main from HtmlTestRunner import HTMLTestRunner from selenium import webdriver

class AddRemoveElements(TestCase):

@classmethod
def setUpClass(cls):
    cls.driver = webdriver.Chrome(executable_path='./chromedriver.exe')
    driver = cls.driver
    driver.implicitly_wait(10)
    driver.maximize_window()
    driver.get("http://the-internet.herokuapp.com")
    driver.find_element_by_link_text('Disappearing Elements').click()

def test_name_elements(self):
    driver = self.driver
    options = []
    no_options = 5
    tries = 1

    while len(options) < 5:
        options.clear()
        for i in range(no_options):
            try:
                option_name = driver.find_element_by_xpath(f'//ul/li[{i+1}]/a')
                options.append(option_name.text)
                print(options)
            except:
                print(f'Option number {i+1} was NOT FOUND')
                tries += 1
                driver.refresh()
    
    print(f'Finished in {tries} tries')

@classmethod
def tearDownClass(cls):
    cls.driver.implicitly_wait(5)
    cls.driver.quit()

if name == "main": main(verbosity=2, testRunner=HTMLTestRunner( output="reports/dinamic_elements", report_name="test_dinamic_elements", add_timestamp=False)) `

What I Did

As you can see, I have some print statements, but in the console I am not getting them in the console

image

My expected result is

image

As you can see here, the print statements appear in console

axvargas avatar Jun 10 '21 15:06 axvargas