selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

Selenium ide runner html report generate

Open manikantayarramsetti1 opened this issue 1 year ago • 15 comments

💬 After running selenium ide test, How to generate html report

I was added multiple test suite contains multiple tests.After selenium ide running i want to generate html report how can i do

manikantayarramsetti1 avatar Jun 28 '23 13:06 manikantayarramsetti1

@manikantayarramsetti1 - Please keep this to one github issue. If you continue spilling this elsewhere I'll be forced to look up ways of minimizing your ability to have dialogue here.

toddtarsi avatar Jun 29 '23 20:06 toddtarsi

@manikantayarramsetti1 - I'll keep this issue open. If more people come out of the woodwork needing html reports from the ide, I'll add a hotkey to copy the dom tree to the clipboard in v4.

toddtarsi avatar Jun 30 '23 00:06 toddtarsi

@toddtarsi - It will be extremely helpful to have html reports generated when we run multiple tests from Selenium IDE.

pravin2185 avatar Jun 30 '23 14:06 pravin2185

@pravin2185 - What do you need that you can't get by using 'print screen' with a region?

toddtarsi avatar Jun 30 '23 16:06 toddtarsi

@pravin2185 - What do you need that you can't get by using 'print screen' with a region?

manikantayarramsetti1 avatar Jun 30 '23 16:06 manikantayarramsetti1

@pravin2185 - What do you need that you can't get by using 'print screen' with a region?

@toddtarsi can you please this issue once https://github.com/SeleniumHQ/selenium-ide/issues/1670

manikantayarramsetti1 avatar Jun 30 '23 16:06 manikantayarramsetti1

@toddtarsi - I haven't used 'print screen' with region. Is there any reference for it?

pravin2185 avatar Jun 30 '23 18:06 pravin2185

Actually I am looking to output some values to output File in Selenium IDE.

pravin2185 avatar Jun 30 '23 18:06 pravin2185

@pravin2185 - I'm sorry, that isn't something I'm interested in pursuing. I'd be supportive of either of you or anyone else electing to become a plugin author for html reports from the IDE, and I'd be glad to help assist those efforts, but this isn't a feature important enough to the core functionality of the tool to be worth it to me to write myself.

toddtarsi avatar Jun 30 '23 21:06 toddtarsi

@pravin2185 - I'm sorry, that isn't something I'm interested in pursuing. I'd be supportive of either of you or anyone else electing to become a plugin author for html reports from the IDE, and I'd be glad to help assist those efforts, but this isn't a feature important enough to the core functionality of the tool to be worth it to me to write myself.

@toddtarsi Currently does we have any plugin that can generate html reports

manikantayarramsetti1 avatar Jul 01 '23 04:07 manikantayarramsetti1

I can save the file in text form but the content is "undefined"

HAAFAOFC avatar Aug 23 '23 00:08 HAAFAOFC

@manikantayarramsetti1 - I'm sorry, one doesn't exist yet.

@MOZ8er - What are you saving? Is there some way I can help whatever you're going for here?

toddtarsi avatar Aug 23 '23 02:08 toddtarsi

i want to save text from the browser

HAAFAOFC avatar Aug 23 '23 07:08 HAAFAOFC

Oh, interesting! So you're wanting to scrape stuff and save it to a file. I don't want to make that part of selenium-ide core because it's sort of tangential, and I don't want to have to maintain it, but writing a plugin to do this shouldn't be that bad.

Check out this example plugin:

https://github.com/SeleniumHQ/selenium-ide/blob/trunk/packages/side-example-suite/src/plugins/custom-click/index.ts

I'd recommend writing a plugin like this (although probably as js instead of ts if you don't want to deal with transpiling code and such).

It shouldn't be too bad to write a custom command called 'save text to file' which takes a selector for the text and a filepath to write to

toddtarsi avatar Aug 23 '23 11:08 toddtarsi

Here I had chatgpt take a first try at the plugin for you. If you paste this file onto your FS and reference it via relative filepath from your project, you'll have a first pass at this functionality:

const fs = require('fs').promises;

/**
 * This is a demo plugin that fetches text from a specified selector and writes it to a file.
 */

const plugin = {
  commands: {
    fetchAndWrite: {
      name: 'fetch and write',
      description: 'Fetch text from a selector and write it to the specified file',
      target: {
        name: 'locator',
        description: 'The selector from which text should be fetched',
      },
      execute: async (command, driver) => {
        try {
          const text = await driver.getText(command.target);
          await fs.writeFile(command.value, text);
          console.log(`Text from selector ${command.target} was written to ${command.value}`);
        } catch (err) {
          console.error('Error:', err);
        }
      },
    },
  }
}

module.exports = plugin;

toddtarsi avatar Aug 23 '23 12:08 toddtarsi