Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用带有 java 的 WebDriver。我想使用 JavaScript 在文本字段中输入一些文本。我怎样才能做到这一点?
考虑在 Google 搜索文本字段中输入文本,以下代码应该可以工作:
WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse = (JavascriptExecutor) driver; jse.executeScript("document.getElementById('gbqfq').value = 'Ripon Al Wasim';");