Creating an HTML table for displaying a summary of test execution results in the body of an email using Outlook

Context: Within our project, which is based on selenium-cucumber-java-Mvn, we utilize the master thoughts Cucumber report (mvn dependency) for test execution reporting. This report is generated in the test>target directory and the link to this folder is automatically shared via email for reporting purposes. Recipients are required to click on the provided link to view the status. The link takes the following format: http://localhost:63342/Automation/TestExecutionReports/02-08-2018/Run-1/cucumber-html-reports/overview-features.html

Inquiry: Currently, there is a need to include an Execution summary in the email to allow recipients to view the high-level status without navigating through the provided link. Therefore, we are looking to insert a tabular format with columns such as TC Name, Status, Execution Time, Overall Count, etc. directly into the email body along with the aforementioned link. Is there anyone who can assist me with implementing this?

Additional Details: I am not well-versed in the internal workings of the master though tool, but it collects execution data through a JSON file. Our current report is generated in the onExecutionfinish method of TestNGExecutionListener. The structure of our JSON file includes the following information:

[
  {
    "line": 1,
    // Additional JSON content
  }
]

https://i.stack.imgur.com/ChR8R.png

Answer №1

While I don't have specific code to provide, one possible approach could involve creating a Table Template that includes its Header, Main Table, Rows, Columns, and Footer. From there, you can fetch the data from the features.html page mentioned in the URL and populate the table accordingly using Selenium's standard methods like getText(). Once the table is complete, you can store it in a StringBuilder and include it as part of an email message by setting the content of htmlSourceEmbed to text/html format. Hopefully, this suggestion proves useful for your task.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unable to access full page source using Selenium

After manually visiting the site through Chrome and checking the source HTML, I can see the full page source. However, when loading the page source via selenium, I am not receiving the complete content. from bs4 import BeautifulSoup from selenium import ...

Ubuntu's path for the geckodriver in Mozilla

I recently installed the Ruby gem selenium-webdriver, but I am encountering issues as it is unable to find the geckodriver PATH. How can I successfully add the Mozilla/geckodriver path to my Ubuntu PATH? ...

I am interested in displaying webtable information within an Excel spreadsheet

I am facing an issue where the Excel values are not being displayed as expected. Here is the code snippet I am using: driver.get(""); WebDriverWait wait=new WebDriverWait(driver, 30); List<WebElement> dropdown =wait.until(ExpectedConditions ...

The send_keys function in Selenium fails to function properly when using Chrome browser

Recently, I've been working on writing Python autotests for a web UI and encountered an issue with the send_keys() method after updating my Chrome driver. When trying to input text into a field using send_keys(), it behaves strangely. For example: na ...

Chrome has recently updated to version 92, causing unexpected exceptions even when the driver is said to be compatible

After updating the Chrome driver to version 92.0.4515.107 and installing the .rpm file for Chrome version 92, I encountered an exception when running the code: selenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching ...

Changing the user agent string dynamically in chromedriver using selenium at runtime

I have a project that requires me to modify the user agent. Initially, I provided the user agent as... (to chromedriver) options.addArguments("--user-agent=Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mob ...

Retrieve text using Selenium WebDriver in C#

Looking at the HTML element on my page: <li id="city" class="anketa_list-item"> <div class="anketa_item-city">From</div> London </li> I managed to locate this element: driver.FindElement(By.Id("city")) When I use: driver. ...

Selenium failing to detect Timeout Exception

While I am new to using Selenium, I have found it quite enjoyable so far. However, I have encountered a frustrating issue that I can't seem to solve. No matter what I try, I just can't catch an "OpenQA.Selenium.WebDriverTimeoutException was unhan ...

I encountered an issue with web automation in Python using the Selenium library

Currently exploring web automation and facing an issue that I can't seem to solve.. Code- from selenium import webdriver site = webdriver.Chrome() site.get('https://www.youtube.com') searchbar = site.find_element_by_xpath('//*[@id=&quo ...

Utilizing an Android application to control and modify online content

In the past, I was familiar with Selenium and WebDriver, which allowed for manipulating webpage elements like Textfields and Buttons through code. However, I'm uncertain if these tools are still available or relevant today. For instance, imagine I ha ...

Tips for Verifying Success and Error Messages from a Login Form with Selenium Automation Testing

The code snippet provided below demonstrates how to perform a G-mail login using Selenium WebDriver. package gmail_Login; import java.util.concurrent.TimeUnit; import org.junit.After; import org.junit.Before; import org.junit.Test; import org.openqa.selen ...

Is it possible to execute selenium tests without utilizing the Webdriver interface in your codebase?

Recently, I experimented with running a Selenium test without utilizing the Webdriver interface in my code. Surprisingly, the code performed as expected without encountering any issues. System.setProperty("webdriver.chrome.driver", "C://Java learning//Sel ...

Solutions for resolving a TimeoutException with Selenium in Python can be found by analyzing the message, screen, and stack

Recently, I've been diving into my first Selenium project. The target website for scraping is here. Upon scrolling down, there is a responsive element called "Siswa" which, when clicked, displays several tables. Unfortunately, encountering errors has ...

Ensuring Image Visibility: Validating the Presence of an Image in a Specific Webpage Section

I'm currently working on writing a test that has the capability to perform the following tasks: 1. Navigate to a specific website. 2. Go to a particular page within the site's menu. 3. Once on that page, verify that the image I'm looking for ...

Is it possible to utilize a shared data provider method for multiple test cases in Selenium? Can we specify the Excel file path and sheet name within the common data provider?

My current scenario involves having multiple test cases named classAtest1, classAtest2, classAtest3, and so on. Each class requires a separate data provider method to retrieve the necessary data. However, I am looking to streamline this process by creati ...

Retrieving items from a JavaScript pop-up window using Selenium

While using Selenium to scrape data from an online database, I encountered a challenge with a pop-up window that appears when trying to export the selected results. The issue lies in the changing nature of element IDs within this pop-up, such as the submit ...

When attempting to close the current window in Python, Windows Handling automatically shuts down the entire browser

Currently, I am using Windows handling to open the map directions in a new window. After the new window opens, I close it and continue with the remaining work in the code. However, instead of just closing the child window, the whole browser is being closed ...

Mastering FluentWait for automated Selenium testing

Below is the code snippet I'm currently using, sourced from a response on StackOverflow: Wait<WebDriver> wait = new FluentWait<>(driver) .withTimeout(60, TimeUnit.SECONDS) .pollingEvery(5, TimeUnit.SECONDS) .ignoring(NoSuchEle ...

python conducting automation tests with Selenium WebDriver on a mouse

Hello, I'm having trouble with opening the Mouser website and using the search bar to send some data. Below is a sample of the code I've been working on, but I can't seem to find the correct CSS selector. Any help would be greatly appreciate ...

Encountering a java.net.MalformedURLException when checking the response code

While checking the response code of URLs in the snippet below, I encountered an error. The goal is to fetch all URLs on the page and verify if their response code is 200. XSSFCell cell3 = newRow.createCell(2); cell3.setCellValue(httpURLConnect.getResponse ...