Answer the question
In order to leave comments, you need to log in
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)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question