locator-labs 元素定位生成器

一个强大的桌面应用,能为Playwright、Selenium和Cypress测试自动化框架生成可靠且易维护的定位器。无需浏览器扩展------在企业级/受限环境中都能正常工作!

官方网站

复制代码
https://www.locator-labs.com/

github桌面版地址

复制代码
https://github.com/naveenanimation20/Locator-Labs-App-Releases?tab=readme-ov-file

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# 文件名:1.py
# 作者:Administrator
# 日期:2026/1/30
# 描述:
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome()

wait = WebDriverWait(driver, 10)

driver.maximize_window()

driver.get("https://www.bilibili.com/")

wait.until(EC.presence_of_element_located((By.LINK_TEXT, "番剧"))).click()

driver.switch_to.window(driver.window_handles[-1])

wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, "div.background-cover"))).click()

driver.switch_to.window(driver.window_handles[-1])

driver.find_element(By.XPATH, "//*[local-name()='path' and starts-with(@d,'M9.77234 30.8573V11.7471H7.545')]")


time.sleep(16)

driver.quit()

实际用下来点赞这个按钮还是定位不到,比较复杂的元素定位还是不太行,如果是用ui不太复杂的页面,还是挺香。

相关推荐
wj3055853783 小时前
课程 9:模型测试记录与 Prompt 策略
linux·人工智能·python·comfyui
星寂樱易李4 小时前
iperf3 + Python-- 网络带宽、网速、网络稳定性
开发语言·网络·python
qingfeng154154 小时前
企业微信机器人开发:如何实现自动化与智能运营?
人工智能·python·机器人·自动化·企业微信
彦为君7 小时前
Agent 安全:从权限提示到沙箱隔离
python·ai·ai编程
PILIPALAPENG8 小时前
Python 语法速成指南:前端开发者视角(JS 类比版)
前端·人工智能·python
用户8356290780519 小时前
Python 操作 PowerPoint 页眉与页脚指南
后端·python
枫叶林FYL9 小时前
项目九:异步高性能爬虫与数据采集中枢 —— 基于 Crawl<sub>4</sub>AI 与 Playwright 的现代化数据采集平台 项目总览
爬虫·python·深度学习·wpf
猫猫的小茶馆10 小时前
【Python】函数与模块化编程
linux·开发语言·arm开发·驱动开发·python·stm32
Miss_min10 小时前
128K长序列数据生成
开发语言·python·深度学习