Using Selenium with Python, I am trying to take screenshot and saving them in a folder which has date and timestamp but nothing is getting saved in the folder. This is the code snippet:
Folder creation activity:
path = 'C:\\Users\\name\\Desktop\\ADF'
DateString = datetime.datetime.now().strftime("%Y_%m_%d_%H_%M_%S")
os.chdir(path)
NewFolder = 'PBI_' + DateString
os.makedirs(NewFolder)
To save the screenshot, I am using:
driver.save_screenshot(os.path.join(os.path.dirname(os.path.realpath(__file__)), NewFolder,'Before_Authentication.png'))
Folder name "NewFolder" is getting created successfully but no screenshot is present here.