“WebElement”对象没有“set\u value”属性

2024-04-19 17:07:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用appium在android应用程序的editbox中设置一个值。我正在使用python脚本将其自动化。但我总是犯一些错误。
我的python脚本是

import os
import unittest
import time
from appium import webdriver
from time import sleep
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By 
import uiautomator
import math



        element = self.driver.find_element_by_class_name('android.widget.EditText')
        element.set_value('qwerty')
        element = self.driver.find_element_by_name("Let's get started!")
        element.click()
        time.sleep(5)

当我运行它时,总是会遇到一个错误:

AttributeError: 'WebElement' object has no attribute 'set_value'

Tags: fromimportself脚本bytimedriverselenium