简体   繁体   中英

Raw html in TestNG Emailable Report

This question is regarding an issue i am facing when copied an existing framework to a new set up. It worked before with another company. I cant figure out what is wrong in the html format. Web automation with selenium java with testNG I used to output screenshot links to testng emailable report using reporter.log. The functionality was working before with same framework in my previous project. Now I imported the project to reuse framework, everything else is working as expected but the html report showing raw html tag for a linked screenshot. Screenshot creation successful and the png file is in the specified path.

Emailable report showing following raw html :

<a href='C:\Users\kk\Desktop\New folder\SCREENSHOTS\TEST_11_07_2019_12_35_48.png'><img src='C:\Users\kk\Desktop\New folder\SCREENSHOTS\TEST_11_07_2019_12_35_48.png' height='500' width = '1021'></a>

Expected a clickable thumbnail of size 500x1021 pointing to original image.

Tried following : -Update webdriver version to match chrome version (75) -Replace single quotes with double quotes in the html tag -Tried to output a working mailto link to emailable report Always the html code not rendered, showing raw html

public void getScreenShot(String name, WebDriver dr) {

<CODE FOR screenshot capture and name and save here>...

// To help linking screenshots in testNG report
Reporter.log("<a href='" + destFile.getAbsolutePath() + "'><img src='" + destFile.getAbsolutePath()+ "' height='500' width = '1021'></a>");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

最终通过将Eclipse IDE降级为Oxygen解决了该问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM