How to find and write inside an input tag with selenium python(如何使用 selenium python 在输入标签中查找和写入)
问题描述
我想将网站 我想更改它的 MA Length 在 Vol 中的值,您可以通过单击网站左上角 Apple Inc - D - Cboe BZX 正下方的 Vol(20) 来访问它.
使用
- 选择一个合适的 定位器策略,这将允许唯一地匹配元素页面
- 定位元素
- 以这种方式将定位代码包装到 显式等待中 您的测试将更加稳健和可靠
- 使用 WebElement API 进行交互带元素
示例代码:
driver.get("https://www.tradingview.com/chart/")WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(@class,'format')]"))).click()输入 = WebDriverWait(驱动程序,10).until(EC.element_to_be_clickable((By.XPATH, "//input[contains(@class,'innerInput')]")))driver.execute_script("arguments[0].value=30", 输入)
I would like to change a value of a input tag that haves the value 20 to 110 in the website https://www.tradingview.com/chart/. How can I actually do that?(all of that using selenium python) The value i would like to change it's MA Length inside Vol, you can acess that by clicking at Vol(20) right below Apple Inc - D - Cboe BZX at the top left part of the website.
Locate the element you would like to interact with using your favourite browser developer tools
- Choose an appropriate Locator Strategy which will allow to uniquely match the element at the page
- Locate the element
- Wrap the locating code into an Explicit Wait this way your test will be more robust and reliable
- Use WebElement APIs to interact with elements
Example code:
driver.get("https://www.tradingview.com/chart/")
WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.XPATH, "//a[contains(@class,'format')]"))).click()
input = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.XPATH, "//input[contains(@class,'innerInput')]")))
driver.execute_script("arguments[0].value=30", input)
这篇关于如何使用 selenium python 在输入标签中查找和写入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用 selenium python 在输入标签中查找和写入


- ";find_element_by_name(';name';)";和&QOOT;FIND_ELEMENT(BY NAME,';NAME';)";之间有什么区别? 2022-01-01
- 使用公司代理使Python3.x Slack(松弛客户端) 2022-01-01
- 检查具有纬度和经度的地理点是否在 shapefile 中 2022-01-01
- 使用 Cython 将 Python 链接到共享库 2022-01-01
- 计算测试数量的Python单元测试 2022-01-01
- 我如何透明地重定向一个Python导入? 2022-01-01
- 如何使用PYSPARK从Spark获得批次行 2022-01-01
- YouTube API v3 返回截断的观看记录 2022-01-01
- 我如何卸载 PyTorch? 2022-01-01
- CTR 中的 AES 如何用于 Python 和 PyCrypto? 2022-01-01