给只读文本框赋值,这里列举了两种方式。一种是去掉文本框的只读属性,另一种是添加value属性,直接赋值。
只读文本框截图
package com.test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
public class ReadOnly {
WebDriver driver = null;
@BeforeTest
public void beforeTest() {
System.setProperty("webdriver.chrom

本文介绍了如何使用Webdriver在JavaScript环境下,针对只读属性的文本框实现赋值操作,提供了两种有效方法:一是临时移除只读属性,二是直接通过value属性设置值。
最低0.47元/天 解锁文章
1433

被折叠的 条评论
为什么被折叠?



