def _perform_keypress(self, element, **kwargs):
"""
This function expects to receive a browser instance through the
"browser" argument and a key "keys" through the kwargs.
The value for "keys" would be a list of keys tha need to pressed.
"""
status = True
flag = False
keys = kwargs.get('keys')
actions = ActionChains(element)
for key in keys:
try:
selenium_key = KEYS[key.upper()]
except KeyError:
print_error("{0} is not supported by Selenium.".format(key))
status = False
else:
flag = True
actions.send_keys(selenium_key)
if flag:
actions.perform()
sleep(2)
return status
element_operations.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录