kings_selenium
基于chrome的使用selenium将web端和appium常用方法封装集成成一个简单的类,其中节点查询和点击都是基于异步的,不需要再在程序中使用time.sleep(x)
安装
pip install -i https://pypi.org/simple/ kings_selenium
配置 config.json
配置文件,路径为当前项目的根目录创建一个config文件夹,里面再创建config.json
公共
POLL_FREQUENCY
异步查询节点轮循时间,单位秒,默认0.5
TIMEOUT
节点查询超时时间
web端
CHROME_DEBUGGER_ADDRESS
谷歌浏览器调试地址,默认,使用此参数需要先启动谷歌浏览器调试模式 127.0.0.1:9222
DRIVER_LOCATION
chrome driver驱动路径,使用web时必填
appium
COMMAND_EXECUTOR appium启动调试地址,默认 http://127.0.0.1:4723/wd/hub
DESIRED_CAPABILITIES
appium启动联调参数,使用appium时必填,如
"DESIRED_CAPABILITIES": {
"platformName": "iOS",
"platformVersion": "14.0",
"deviceName": "Kings",
"udid": "xxx",
"appPushTimeout": 300000,
"noReset": "True",
"webkitgtk:browserOptions": {
"excludeSwitches": [
"enable-automation"
],
"args": [
"--incognito",
"--headless",
"--disable-infobars",
"--disable-javascript"
]
}
}
使用
from kings_selenium.selenium_web import SeleniumWeb
seleniumWeb = SeleniumWeb(True)
seleniumWeb.open_url_debug("https://www.baidu.com")
seleniumWeb.send_keys_by_id("kw", "hello")
seleniumWeb.click_by_id("su")
app端
from kings_selenium.selenium_phone import SeleniumPhone
"""模拟京东app点击我的"""
seleniumPhone = SeleniumPhone('/Users/wilson/Desktop/jd.ipa')
seleniumPhone.click_by_xpath('//XCUIElementTypeStaticText[@name="我的"]')
Metadata
Release files for kings-selenium 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kings_selenium-1.0.3.tar.gz | 4.9 kB | Without provenance | Details for kings_selenium-1.0.3.tar.gz |
Release files / kings_selenium-1.0.3.tar.gz
| Download URL | kings_selenium-1.0.3.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
02379a1928801615b1fada777c6deaa0a824835497db1add1e3365ae62e5e734
|
|
BLAKE2b-256 checksum How to use checksums |
bd8927d1782b4f47c359986498915b38766b0b48f0a302066cac7045879351b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.5.0.1 requests/2.25.1 setuptools/46.0.0.post20200309 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6
|
Security for kings-selenium 1.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.