我正在尝试获取appium
的当前正在运行的会话驱动程序实例,
有一篇帖子试图回答类似的问题,但实际上并非Robot Framework - passing Appium driver to python script
这是到目前为止的代码
from appium.webdriver.common.touch_action import TouchAction
from appium.webdriver.common.multi_action import MultiAction
from AppiumLibrary import AppiumLibrary
class Custom(AppiumLibrary):
def __init__(self):
super().__init__()
self.driver = self._current_application() #line with error
#The code below just to show an example of usage
def zoomin(locator, percent, steps):
customobj = Custom()
action1 = TouchAction(customobj.driver)
action2 = TouchAction(customobj.driver)
m_action = MultiAction(customobj.driver)
xx = customobj.driver.get_window_size()['width'] / 2
yy = customobj.driver.get_window_size()['height'] / 2
action1.long_press(x=xx, y=yy).move_to(x=0, y=50).wait(500).release()
action2.long_press(x=xx, y=yy).move_to(x=0, y=-50).wait(500).release()
m_action.add(action1, action2)
我在“ 未打开任何应用程序 ”
上面提到的行上收到此错误请注意,我的应用程序是通过robotframework启动并运行的,我希望能够: