Selenium is widely used for automated testing of web systems. It supports multiple languages such as Java, Python, and C #. Java is used in this article. The Code is as follows:
File file = (takesscreenshot) driver). getscreenshotas (outputtype. File); fileutils. copyfile (file, new file ("screen.png "));
Later, when I used robotium to write Android automation, I found the Android-Spoon plug-in on GitHub. This plug-in can generate HTML reports during Android automation and provide single-host image preview, multi-host image comparison and other functions. As a result, selenium can also be used. Initially implemented and gradually improved. The following functions are available:
HTML browsing in case executed on a separate browser
Preview GIF dynamic images of a single case
View logs during case execution (using log4j)
Plug-in source https://github.com/yeetrack/selenium-spoon-plugin
Selenium sample engineering https://github.com/yeetrack/selenium-spoon-sampler using this plug-in
Report preview generated by plug-in: http://htmlpreview.github.io /? Bytes.
As follows:
Plugin usage:
Add the following dependency to the POM of your selenium project:
<Dependency> <groupid> com. yeetrack. Selenium </groupid> <artifactid> spoon </artifactid> <version> 1.0 </version> </dependency>
Add Plugin:
<Plugin> <groupid> COM. yeetrack. selenium </groupid> <artifactid> spoon </artifactid> <version> 1.0 </version> <executions> <execution> <ID> spoon Report </ID> <phase> post -Integration-test </phase> <goals> <goal> spoon </goal> </goals> </execution> </executions> </plugin>
Note: If the selenium-Spoon package cannot be found in the maven repo repository, you can install the selenium-Spoon package in the local Maven repository:
Continue reading -->