Hi,
I am using Katalon Studio + Winium implementation to automate one of our windows application.
Test Script is written with help from Winium driver in Katalon studio script mode.
Script runs perfectly but in Reports Screenshot is not captured.
Wanted to know how can we capture screenshot using winium + Katalon and make sure it appears in test suite report
1 Like
hello,
maybe this will help you, and follow this link http://forum.katalon.com/t/is-there-anyway-to-implement-more-annotation-in-test-event-listener/14385/22
these imports are needed
import org.apache.commons.io.FileUtils
import org.openqa.selenium.OutputType
public void getscreenshot(WebDriver d) throws Exception
{
File scrFile = ((TakesScreenshot)d).getScreenshotAs(OutputType.FILE);
//The below method will save the screen shot in x drive with name "screenshot.png"
FileUtils.copyFile(scrFile, new File("C:\\Users\\xxxx\\Desktop\\data\\screenshot.png"));
}
sorry ! this is not the solution, coming later ....
this is hard to implement cause Winium WebDriver object cannot to be converted to Katalon TestObject
No signature of method: winium.testWiniumClass.fromElement() is applicable for argument types: (org.openqa.selenium.winium.WiniumDriver) values: [WiniumDriver: on ANY (AwesomeSession)]
tried to convert with these functions
WiniumDriver d;
…
TestObject to = new TestObject()
to = fromElement(d)
…
protected String getXPathFromElement(RemoteWebElement element) {
String elementDescription = element.toString();
return elementDescription.substring(elementDescription.lastIndexOf("-> xpath: ") + 10, elementDescription.lastIndexOf("]"));
}
protected TestObject fromElement(RemoteWebElement element) {
TestObject testObject = new TestObject();
testObject.addProperty("xpath", ConditionType.EQUALS, getXPathFromElement(element));
println testObject
return testObject;
}
1 Like