selenium-ide web 自动化录制工具

发布于:2024-12-18 ⋅ 阅读:(84) ⋅ 点赞:(0)

https://www.selenium.dev/selenium-ide/ 官方下载插件安装

http://www.winwin7.com/soft/12693.html 官方下载不下来用这个安装的,拖过去安装

selenium的IDE插件进行录制和回放并导出为python/java脚本(10)_selenium ide脚本导出-CSDN博客

 

# Generated by Selenium IDE
import pytest
import time
import json
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support import expected_conditions
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

class TestTest1():
  def setup_method(self):
    self.driver = webdriver.Chrome()
    self.vars = {}
  
  def teardown_method(self):
    self.driver.quit()
  
  def test_test1(self):
    self.driver.get("https://www.baidu.com/")
    time.sleep(5)
    self.driver.maximize_window()
    time.sleep(5)
    self.driver.find_element(By.ID, "kw").click()
    time.sleep(5)
    self.driver.find_element(By.ID, "kw").send_keys("ubuntu使用")
    time.sleep(5)
    self.driver.find_element(By.ID, "su").click()
    time.sleep(5)
  
if __name__ == '__main__':
  test = TestTest1()
  test.setup_method()
  test.test_test1()
  test.teardown_method()


网站公告

今日签到

点亮在社区的每一天
去签到