当前位置: 首页 > news >正文

上海住房和城乡建设委员会官方网站专业搜索引擎seo公司

上海住房和城乡建设委员会官方网站,专业搜索引擎seo公司,手机版万能视频提取器,商业型网站基于 Python 的 Page Factory 设计模式测试库, 类似于Java的Page Factory模式,旨在减少代码冗余,简单易用,具有高度的可扩展能力。 支持以annotation的方式定义元素 支持同一个元素多种定位方式 支持动态的定位方式 安装 pip install pyth…

基于 Python 的 Page Factory 设计模式测试库, 类似于Java的Page Factory模式,旨在减少代码冗余,简单易用,具有高度的可扩展能力。

支持以@annotation的方式定义元素
支持同一个元素多种定位方式
支持动态的定位方式

安装

pip install pythium

用法

from pythium import find_by, android_find_by, ios_find_by
from pythium import find_all, ios_find_all, android_find_all, Page, by
from appium.webdriver.webelement import WebElement as MobileElement
from selenium.webdriver.remote.webelement import WebElement
from typing import Any, List


class LoginPage(Page):

    @find_by(css=".search")
    @ios_find_by(ios_predicate='value == "Search something"')
    @android_find_by(android_uiautomator='resourceId("com.app:id/search_txtbox")')
    def search_input(self) -> WebElement: ...

    @property
    @find_by(css=".search")
    @ios_find_by(ios_predicate='value == "Search something"')
    @android_find_by(android_uiautomator='resourceId("com.app:id/search_txtbox")')
    def search_input_with_property(self) -> WebElement: ...

    @property
    @find_all(by(css=".icon-logo1"), by(css=".icon-logo"))
    def find_all_web_test(self) -> WebElement: return Any

    @property
    @ios_find_all(by(ios_predicate='value == "Search something"'), by(ios_predicate='value == "Search result"'))
    @android_find_all(by(android_uiautomator='resourceId("com.app:id/search_txtbox")'), by(android_uiautomator='resourceId("com.app:id/search_txtbox")'))
    def find_all_mobile_test(self) -> WebElement: return Any

    # for dynamical locator
    @find_by(xpath="//div[{n}]/a[{k}]/div[{m}]/{f}")
    @ios_find_by(xpath="//div[1]/a[{n}]/div[{k}]")
    def dynamical_locator(self, n, k, m=4, f=6) -> WebElement: ...

    # for list WebElements
    @find_by(css=".login")
    def list_web_elements(self) -> List[MobileElement]: ...```

    def _is_loaded(self):
        print("implement something...")

if __name__ == '__main__':
    from selenium import webdriver
    driver = webdriver.Chrome()
    login = LoginPage(driver)
    # no @property
    login.search_input.click()
    # with @property
    login.search_input_with_property.click()
    # for dynamical locator
    login.dynamical_locator(2, 3, 4, 5).click()
    # for list WebElement
    print(len(login.list_web_elements()))

find_all, ios_find_all, android_find_all 使用多个定位元素,元素之间为or的关系,按顺序查找

例子: @find_all(by(css=".icon-logo1"), by(id="icon"))
首先查找元素 by(css=".icon-logo1"), 如果找到则返回 WebElement;
如果没找到则通过 by(id="icon")继续找, 如果找到则返回WebElement, 最后没找到则抛出异常 Exception.
 

http://www.hengruixuexiao.com/news/51480.html

相关文章:

  • 曲靖网站建设淘宝产品关键词排名查询
  • 做招牌的网站有哪些百度官方优化软件
  • 电脑做的本地网站手机看百度注册公司地址
  • 基于MVC网站建设课程设计报告18款禁用看奶app入口
  • 网站建设需求发布2024最火的十大新闻有哪些
  • 成都建筑设计有限公司seo搜索引擎优化教程
  • 如何拥有自己的网站域名湖南专业关键词优化服务水平
  • 菜谱网站手机源码百度广告
  • 网站上线倒计时html5模板如何优化关键词搜索排名
  • 杭州外贸网站建设公司百度站点
  • 上海黄浦 网站制作友情链接怎么添加
  • 北京网站制作与建设公司手机百度搜索
  • 十大不封号直播平台seo外推软件
  • seo上海推广公司优化网站搜索排名
  • 有没有做网站的软件专业的网站建设公司
  • 代做原创毕业设计网站东莞网站优化关键词排名
  • 手机模板网站开发站长统计app软件下载官网
  • 有哪些做网站的网站成都私人网站建设
  • 网站开发工程师ppt自助建站系统破解版
  • 简历模板网站有哪些互联网广告销售
  • 建外贸商城网站会计培训班需要学多长时间
  • 深圳网站建设费用多少钱湖人最新消息
  • 一个新手怎么做电商运营济南做seo的公司排名
  • 网站建设项目标书app软件开发
  • 路由器做映射后 内网可以访问到我的网站 但是外网无法访问沪指重上3000点
  • 优秀包装设计网站互联网公司排名2021
  • 国内做网站上市公司廊坊网站建设优化
  • 建设工程网站新专家入库seo技巧
  • 做废品交易看什么什么网站企业营销策划
  • 服务器怎么添加网站会计培训班初级费用