save screenshot into another directory /u/Efficient_Set9050 Python Education

Hi guys, complete noob here. Trying to save a screenshot from cwd “testcases” and save in another directory “screenshots” using the code below. However, when I run the script everything runs fine but the screenshot doesn’t save in the directory I want (screenshots)

import os self.driver.save_screenshot(os.path.abspath(os.curdir)+"\screenshots\"+"test_account_reg.png") 

I’ve also tried this below:

import os from os import path file_dir = path.join(os.getcwd(), "screenshots") os.makedirs(file_dir, exist_ok=True) file_path = path.join(file_dir, "screenshot_one.png") driver.save_screenshot(file_path) 

but all that does is create a subcategory in my cwd (testcases), which I don’t want. Any ideas how to rectify?

submitted by /u/Efficient_Set9050
[link] [comments]

​r/learnpython Hi guys, complete noob here. Trying to save a screenshot from cwd “testcases” and save in another directory “screenshots” using the code below. However, when I run the script everything runs fine but the screenshot doesn’t save in the directory I want (screenshots) import os self.driver.save_screenshot(os.path.abspath(os.curdir)+”\screenshots\”+”test_account_reg.png”) I’ve also tried this below: import os from os import path file_dir = path.join(os.getcwd(), “screenshots”) os.makedirs(file_dir, exist_ok=True) file_path = path.join(file_dir, “screenshot_one.png”) driver.save_screenshot(file_path) but all that does is create a subcategory in my cwd (testcases), which I don’t want. Any ideas how to rectify? submitted by /u/Efficient_Set9050 [link] [comments] 

Hi guys, complete noob here. Trying to save a screenshot from cwd “testcases” and save in another directory “screenshots” using the code below. However, when I run the script everything runs fine but the screenshot doesn’t save in the directory I want (screenshots)

import os self.driver.save_screenshot(os.path.abspath(os.curdir)+"\screenshots\"+"test_account_reg.png") 

I’ve also tried this below:

import os from os import path file_dir = path.join(os.getcwd(), "screenshots") os.makedirs(file_dir, exist_ok=True) file_path = path.join(file_dir, "screenshot_one.png") driver.save_screenshot(file_path) 

but all that does is create a subcategory in my cwd (testcases), which I don’t want. Any ideas how to rectify?

submitted by /u/Efficient_Set9050
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *