def set_screenshot_vars(shared_variables):
''' Save screen capture type and selenium/appium driver objects as global variables, so TakeScreenShot() can access them '''
# We can't import Shared Variables due to cyclic imports causing local runs to break, so this is the work around
# Known issue: This function is called by Sequential_Actions(). Thus, Maindriver can't take screenshots until this is set
sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
global screen_capture_driver, screen_capture_type
try:
if 'screen_capture' in shared_variables: # Type of screenshot (desktop/mobile)
screen_capture_type = shared_variables['screen_capture']
if screen_capture_type == 'mobile': # Appium driver object
if 'device_id' in shared_variables:
device_id = shared_variables['device_id'] # Name of currently selected mobile device
appium_details = shared_variables['appium_details'] # All device details
screen_capture_driver = appium_details[device_id]['driver'] # Driver for selected device
if screen_capture_type == 'web': # Selenium driver object
if 'selenium_driver' in shared_variables:
screen_capture_driver = shared_variables['selenium_driver']
except:
ExecLog(sModuleInfo, "Error setting screenshot variables", 3)
CommonUtil.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录