S
S
Sigure2017-06-05 17:04:50
Python
Sigure, 2017-06-05 17:04:50

How to write to file in unittest class?

There is some test that using selenium webdriver pulls the header from the site.
The task at this moment is to save it to a file that refuses to be written and saved.

def test_store(self):
        driver = self.driver
        driver.get(self.base_url)
        header_h1 = driver.find_element_by_css_selector("h1").text
        with open('header', 'w') as f:
            f.write(header_h1)

So the question is, what am I doing wrong? How to implement a record?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question