import minium
import time
class MyTest(minium.MiniTest):
def test_view(self):
self.page.get_element("view", inner_text="视图容器").click()
self.page.get_element(".navigator-text", inner_text="swiper").click()
self.page.get_elements("switch")[0].click()
self.page.get_elements("switch")[1].click()
assertValue1 = self.page.get_element(".weui-cell__bd").text
self.assertEqual("指示点", assertValue1)
time.sleep(0.5)
self.app.navigate_back()
def test_form(self):
self.page.get_element("view", inner_text="表单组件").click()
self.page.get_element(".navigator-text", inner_text="textarea").click()
self.page.get_element("page > view > view > view:nth-child(1) > view.textarea-wrp > textarea").click()
self.page.get_element("page > view > view > view:nth-child(1) > view.textarea-wrp > textarea").input("小程序自动化测试")
assertValue2 = self.page.get_element("page > view > view > view:nth-child(1) > view.textarea-wrp > textarea").text
self.assertIn("小程序", assertValue2)
time.sleep(0.5)
self.app.navigate_back()
if __name__ == "__main__":
my_test = MyTest()
my_test.test_view()
my_test.test_form()
上面的代码,来源https://blog.csdn.net/m0_67695717/article/details/133305956,我安装好minium后,运行报错:
File "D:\myProgram\ideaJava\yiZhiXiangMuZu\maoYuFanYi\wx-miniprogram-test\venv\lib\site-packages\minium\miniprogram\base_driver\page\skylinepage.py", line 19, in wrapper
raise NotImplementedError(f"skyline页面暂不支持{func.__name__}方法")
NotImplementedError: skyline页面暂不支持get_element方法
小程序是官网给的小程序代码。代码来源:https://developers.weixin.qq.com/miniprogram/dev/devtools/auto/demo.html
谢谢