JavaScript 是一种脚本语言,有的场景需要使用 js 脚本注入辅助我们完成 Selenium 无法做到的事情。 当 webdriver 遇到无法完成的操作时,可以使用 JavaScript 来完成,webdriver 提供了 execute_script() 方法来调用 js 代码。 Selenium 可以通过 execute_script() 来执行 JavaScript 脚本。
Launch the browser and open “Gmail.com”. Verify the title of the page and print the verification result. Enter the username and Password. Click on the Sign in button. Close the web browser. Step 1: ...