gauge icon indicating copy to clipboard operation
gauge copied to clipboard

[SOS]given two driver instance,how can i device use the correct driver takes screenshot?

Open yicaifeitian opened this issue 4 years ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen. When I doing automation test,I found that my spec must have two drivers, one is ie_driver,the other is chrome_driver. Because they will interactive,they play diffrent role. When my scenario faild , it takes screenshot by default . but I found that ,it takes screenshot that it is not I need. the ie_driver broswer cover chrome_dirver. When I try use custom_screenshot_writer , I found that , the code can't be understand. bacause I do not know the driver arg pass.

`

Using Webdriver

from uuid import uuid1 from getgauge.python import custom_screenshot_writer

Return a screenshot file name

@custom_screenshot_writer def take_screenshot(): # Use appropriate webdriver instance image = driver.get_screenshot_as_png() file_name = os.path.join(os.getenv("gauge_screenshots_dir"), "screenshot-{0}.png".format(uuid1().int)) file = open(file_name, "wb") file.write(image) return os.path.basename(file_name) `

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

yicaifeitian avatar Jan 19 '21 08:01 yicaifeitian

This largely depends on your implementation of Driver Factory or however else you manage references to the correct driver in that context.

Gauge or the runner does not control which driver is to be used in a given context.

sriv avatar Jan 19 '21 08:01 sriv