zoukankan      html  css  js  c++  java
  • selenium定位经验总结

    python3 + selenium + iedriver

    1、pageA跳转到pageB,pageB所有元素被封在<frameset>中,跳转过来后要先找到这个<frameset>标签才能定位其中的元素。

    先找到<frameset>标签:

    WebDriverWait(self.ieDriver, 500, 0.5).until(

      EC.presence_of_element_located((By.TAG_NAME, 'frameset')))

    2、window窗口上传文件图片可以借助工具AutoIt V3:

    ;ControlFocus("title","text",controlID) Edit1=Edit instance 1
    ControlFocus("选择要加载的文件", "","Edit1")


    ; Wait 10 seconds for the Upload window to appear
    WinWait("[CLASS:#32770]","",10)


    ; Set the File name text on the Edit field

    ControlSetText("选择要加载的文件", "", "Edit1", "E:Projectpythonswebidswebid_ztbadd_bidding_registion邵武招标登记.xlsx")
    Sleep(2000)

    ; Click on the Open button

    ControlClick("选择要加载的文件", "","Button1");

    3、frame多的情况下,可以调试的时候控制台输入webDriver.find_elements_by_tag_name('frame')/webDriver.find_elements_by_tag_name('iframe').get_attribuate('name')来查找目前所在的哪个frame

  • 相关阅读:
    法院
    Spring Cloud常用组件
    PowerShell使用教程
    浅谈3DES加密解密
    SC win consul
    SB-Token-Jwt
    前端MVC Vue2学习总结
    spring-session-data-redis
    SpringBoot WS
    SpringBoot之使用Spring Session集群-redis
  • 原文地址:https://www.cnblogs.com/chxtdbk/p/9959348.html
Copyright © 2011-2022 走看看