Git Product home page Git Product logo

selenium_larkdoc's Introduction

Selenium_LarkDoc

  • 进入主页面 一个完整循环

  • 点击第一个文档,并切换至打开的文档窗口 elements = driver.find_elements(By.CLASS_NAME, 'file-list-item') # 替换 'element_x' 为实际的选择器 if i < len(elements): elements[i].click()

      # 等待新页面加载
      time.sleep(5)  # 需要根据实际页面加载时间调整等待时长
    
      # 获取所有窗口句柄
      all_handles = driver.window_handles
    
      # 切换到新窗口
      new_window_handle = all_handles[-1]
      driver.switch_to.window(new_window_handle)
    
  • 单击第一行,全选复制 [图片] #选中第一行 elements_inside = driver.find_elements(By.CLASS_NAME, 'text-block-wrapper')

      if elements_inside:
          first_element = elements_inside[0]
    
      first_element.click()
    
      # 执行 Ctrl+A 和 Ctrl+C
      webdriver.ActionChains(driver).key_down(Keys.CONTROL).send_keys('a').key_up(Keys.CONTROL).perform()
      time.sleep(1)  # 等待选中
      webdriver.ActionChains(driver).key_down(Keys.CONTROL).send_keys('c').key_up(Keys.CONTROL).perform()
    
  • 切换至flowus页面 # 获取所有窗口句柄 all_handles = driver.window_handles

      # 切换到新窗口
      new_window_handle = all_handles[-1]
      driver.switch_to.window(new_window_handle)
    
  • 选择新建文档按钮,点击 elements_inside = driver.find_elements(By.XPATH, '//button[@class="rounded-sm cursor-pointer animate-hover"]') if elements_inside: first_element = elements_inside[0]

      first_element.click()
    
  • 选择新建类型为页面,点击 elements_inside = driver.find_elements(By.XPATH, '//div[@class="flex items-center p-1 h-9 animate-hover"]') if elements_inside: first_element = elements_inside[0] first_element.click()

  • 选择第一行,点击(这一步必不可少) elements_inside = driver.find_elements(By.XPATH, '//div[@class="px-0.5 py-1 text-t1 group"]') if elements_inside: first_element = elements_inside[0] first_element.click()

  • 粘贴 webdriver.ActionChains(driver).key_down(Keys.CONTROL).send_keys('v').key_up(Keys.CONTROL).perform()

selenium_larkdoc's People

Contributors

blackiepiggy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.