Unable to view screen shot in Extent Report - selenium

I am using POM with extent report and everything is working fine, also on clicking screen shot its opening in big size but as per the client requirement he need screen shot in bigger size without click on it. I got some suggestion from my senior he said like i need to remove the thumbnail so that it will appear in bigger size, no where i found this option.
<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
<configuration>
<!-- report theme -->
<!-- standard, dark -->
<theme>dark</theme>
<!-- document encoding -->
<!-- defaults to UTF-8 -->
<encoding>UTF-8</encoding>
<!-- protocol for script and stylesheets -->
<!-- defaults to https -->
<protocol>https</protocol>
<!-- title of the document -->
<documentTitle>Dimension Data Automation Reports</documentTitle>
<!-- report name - displayed at top-nav -->
<reportName>Dimension Data - </reportName>
<!-- report headline - displayed at top-nav, after reportHeadline -->
<reportHeadline>Test Automation Report</reportHeadline>
<!-- global date format override -->
<!-- defaults to yyyy-MM-dd -->
<dateFormat>yyyy-MM-dd</dateFormat>
<!-- global time format override -->
<!-- defaults to HH:mm:ss -->
<timeFormat>HH:mm:ss</timeFormat>
<!-- custom javascript -->
<scripts>
<![CDATA[
$(document).ready(function() {
});
]]>
</scripts>
<!-- custom styles -->
<styles>
<![CDATA[
]]>
</styles>
</configuration>
</extentreports>
public class ExtentManager {
private static ExtentReports extent;
public static ExtentReports getInstance() {
if (extent == null) {
Date d = new Date();
//String fileName = d.toString().replace(":", "_").replace(" ", "_") + ".html";
String fileName="index"+".html";
String reportPath = Constants.REPORTS_PATH + fileName;
extent = new ExtentReports(reportPath, true, DisplayOrder.NEWEST_FIRST);
extent.loadConfig(new File(System.getProperty("user.dir") + "/config/ReportsConfig.xml"));
// optional
extent.addSystemInfo("Selenium Version", "2.53.0").addSystemInfo(
"Environment", Constants.ENV).addSystemInfo("Qa","Shiva");
}
return extent;
}
}

This can be done through javascript. Use the <scripts> tag to add the below script
$(document).ready(function() {
var imageElements = $('img.r-img');
for (var i=0; i<imageElements.length; i++) {
imageElements[i].setAttribute('style', 'width:25%;');
}
});
You can set the style for the screenshot (img elements) as per your need.

Related

Android Data Binding "cannot find method"

This is seemingly old at this point. I have been reviewing Android Data Binding Documentation
As well pouring over posts here on SO however nothing seems to work.
No matter how I format the XML I get the same results. When I originally got this working (using lambda without passing arguments) took me a lot of trial and error. Now that i need to pass View in an onClick, im back to trial and error yet nothing is functional.
MainViewModel.java
private void navClicked(#NonNull View view) {
switch (view.getId()) {
case R.id.btn1:
break;
case R.id.btn2:
break;
}
}
public void testBtn() {}
activity_main.xml
<data>
<variable
name="mainViewModel"
type="com.example.viewmodel.MainViewModel" />
</data>
<!-- Works perfectly -->
<!-- however I would need a method for every button and that becomes redundant -->
<Button
android:id="#+id/testBtn"
android:onClick="#{() -> mainViewModel.testBtn()}"
android:text="#string/testBtn" />
<!-- "msg":"cannot find method navClicked(android.view.View) in class com.example.viewmodel.MainViewModel" -->
<Button
android:id="#+id/btn1"
android:onClick="#{(v) -> mainViewModel.navClicked(v)}"
android:text="#string/btn1" />
<!-- "msg":"cannot find method navClicked(android.view.View) in class com.example.viewmodel.MainViewModel" -->
<Button
android:id="#+id/btn2"
android:onClick="#{mainViewModel::navClicked}"
android:text="#string/btn2" />
<!-- "msg":"Could not find identifier \u0027v\u0027\n\nCheck that the identifier is spelled correctly, and that no \u003cimport\u003e or \u003cvariable\u003e tags are missing." -->
<!-- This is missing (view) in the lambda - makes sense to fail -->
<Button
android:id="#+id/btn3"
android:onClick="#{() -> mainViewModel.navClicked(v)}"
android:text="#string/btn2" />
navClicked() was private...
// **denotes change, will not compile like that**
**public** void navClicked(#NonNull View view) {
switch (view.getId()) {
case R.id.btn1:
break;
case R.id.btn2:
break;
}
}
Once I tried this and it worked:
XML:
android:onClick="#{() -> model.clickEvent(123)}"
Model:
public void clickEvent(int id) {...}
I used string for id but I think it also works with integer.

NetSuite, print Custom Item Field of Type:Document along with an Invoice

In NetSuite, some of our Products have MSDS documentation (in the form of PDF files) attached to the record via a Custom Item Field whose "Type" is set to Document. When printing Invoices, we would like to automatically print out any associated MSDS PDF files as well. Is this possible with SuiteScript or any of the other services that extend NetSuite?
(For what it's worth, we know there's an option for printing MSDS documents as part of a Bill of Materials, but printing MSDS docs along with an Invoice doesn't seem to native to NetSuite.)
Luckily you can probably do this with Advanced HTML/PDF templates.
Your MSDS needs to be in a folder that is accessible to the person doing the printing.
Check out http://bfo.com/products/report/docs/tags/tags/pdfset.html
Then your normal invoice would be inside a pdf element something like:
<?xml version="1.0"?>
<!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdfset>
<pdf> <!-- normal invoice here -->
<head>
...
</pdf>
<#assign msdsSeen='' /> <!-- if can use javascript hash as a set then great. othewise use string -->
<#list record.item as item>
<#if item.custcol_msds_link?has_content><!-- needs to be sourced from item -->
<#assign msdsKey='_'+item.custcol_msds_link+'_' />
<#if msdsSeen?indexOf(msdsKey) == -1>
<#assign msdsSeen=msdsSeen + msdsKey />
<pdf src="${item.custcol_msds_link}" />
</#if> <!-- msds not linked -->
</#if> <!-- has msds -->
</#list>
If PDFSET does not works well, you can do the merging using a client application in a server side language like (eg- Java,Node.js).
Write a RESTlet to grab PDFs of record and the attached PDFs. RESTlet will return the PDF in base64 format.
Next, step would be to fetch the PDFs in client application and decode it from base64 and create PDFs. Then using process APIs in client application merge the PDFs using pdftk
PDFtk is a command line tool so you can fairly invoke it using process APIs in your programming language
Below is an example of process APIs in Node.js
var spawn = require('child_process').spawn;
var pdftk = spawn('pdftk', "invoice.pdf attachment.pdf cat output out1.pdf".split(" "));
pdftk.on('close', function (code) {
if(code !==0){
return console.log('Failed PDF with code: ' + code);
}
return console.log ('All good');
});
Below is a Java snippet of Process APIs
Process process = new ProcessBuilder("pdftk","invoice.pdf", "attachment.pdf", "cat", "output", "merged.pdf").start();
errorStream = process.getErrorStream();
errorMessage = readInputStream(errorStream);
if(process.exitValue() == 0) {
trace("successful :)");
}

Dynamically add a tab to actionscript TabBar

I am trying to add a new tab to an actionscript TabBar control at runtime. When I use addChild() to add a tab to the tab bar I get an exception at runtime:
Error: addChild() is not available in this class. Instead, use addElement() or modify the skin, if you have one.
However, when I tried using addElement() instead I get an error at compile time:
1061: Call to a possibly undefined method addElement through a reference with static type spark.components:TabBar.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%"
height="100%">
<fx:Script>
<![CDATA[
import mx.events.FlexEvent;
private var _lastAddedNumber:int = 1;
protected function btnAddNewTab_clickHandler(event:MouseEvent):void
{
tabby.dataProvider.addItem('New '+_lastAddedNumber);
_lastAddedNumber++;
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:Button id="btnSave"
click="btnAddNewTab_clickHandler(event)"
label="Add New Tab"/>
<mx:Form top="50">
<mx:FormItem label="tabWidth:">
<s:HSlider id="slider"
minimum="40"
maximum="120"
value="100"/>
</mx:FormItem>
</mx:Form>
<s:TabBar id="tabby"
horizontalCenter="0"
verticalCenter="0">
<s:layout>
<s:HorizontalLayout gap="-1"
columnWidth="{slider.value}"
variableColumnWidth="false"/>
</s:layout>
<s:dataProvider>
<s:ArrayList source="[red,orange,yellow,green,blue]"/>
</s:dataProvider>
</s:TabBar></s:Application>
may this will help you!!!

Is it possible to take a screenshot of html tag content with OpenLaszlo?

I am creating an openlaszlo application where an html tag will be present and i have some components that are draggable in the swf. I want to drag these components over the html. This is not possible.
So what i am thinking of is to take a screenshot of the html content and replace it with the actual html content when i need to drag over it.
Theoretically this should be possible and it's possible in flex I verified my self. I am trying to do the same thing in Openlaszlo. But i am not getting any leads
So far i have tried like this
And i am getting an error that the html tag is not object of IBitmapDrawable
<canvas width="800" height="600" bgcolor="white" debug="true">
<script when="immediate"><![CDATA[
class MagUtils {
#passthrough (toplevel: true) {
import flash.display.DisplayObject;
import flash.geom.Rectangle;
import flash.geom.Matrix;
import flash.geom.ColorTransform;
import flash.display.Bitmap;
import flash.display.BitmapData;
import flash.filters.*;
import flash.events.MouseEvent;
import mx.graphics.ImageSnapshot;
import flash.utils.ByteArray;
import flash.display.IBitmapDrawable;
}#
var temp:lz.view;
var colorTransform:ColorTransform;
var rect:Rectangle;
public function snap (m:IBitmapDrawable, t:lz.view):void {
temp = t;
var temp_mc = temp.sprite; // getMCRef();
var mainView_mc = main.sprite; // getMCRef();
var scale = 1;
var x;
var y;
var w;
var h;
var imageSnap:ImageSnapshot = ImageSnapshot.captureImage(m);
var imageByteArray:ByteArray = imageSnap.data;
colorTransform = new flash.geom.ColorTransform();
rect = new flash.geom.Rectangle(0, 0, temp.width, temp.height);
var bitmap:BitmapData = new flash.display.BitmapData(w, h, false);
bitmap.setPixels(rect, imageByteArray);
var bm:Bitmap = new Bitmap(bitmap);
temp.sprite.addChild (bm);
bitmap = null;
}
}
lz.MagUtils = new MagUtils();
]]>
</script>
<button name="magnifier" text="magnifyingtool" >
<handler name="onclick">
lz.MagUtils.snap(canvas.main.ht,canvas.temp);
</handler>
</button>
<view name="main" x="5" y="15" width="200" height="200" bgcolor="yellow">
<html name="ht" width="200" height="200" src="http:hello.html"/>
</view>
<view id="temp" name="temp" x="5" y="300" visible="true" width="200" height="200" bgcolor="gray">
</view>
</canvas>
And the HTML Content is
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<HTML>
<HEAD>
<TITLE>
A Small Hello
</TITLE>
</HEAD>
<BODY>
<H1>Hi</H1>
<P>Test Page</P>
</BODY>
</HTML>
It's no possible to take a screenshot in Flash of elements which are not managed by the Flash display list, which includes iFrame content placed below the SWF movie in the browser. And that seems to be what you are trying to do.
If you want to drag a visual object from the iFrame into the SWF movie area, one approach might be to render the content in HTML into an HTML5 canvas element, extract the bitmap data and push that into the SWF movie to be displayed in an OpenLaszlo view. But that would mean that all visual elements you want to drag need to be drawn into an HTML5 canvas.
Here is an example where uses Flash Player's filter functionality to apply the filter to an image in an HTML5 canvas element:
http://www.quasimondo.com/archives/000695.php
Here are the links to the relevant files for this example:
The HTML page embedding an invisible SWF for processing the image.
JavaScript file with functions for sending the data to the SWF movie clip.
ActionScript class processing the image data sent from JavaScript, and passing the processed data back to the HTML page.
But I'm not sure that all the content you have in your iFrame can be rendered into a canvas element.

Loading Components Dynamically in Flex 4

I have an application whereby I am creating tabs in a TabNavigator dynamically. As you can see as per my codes I am basically having 5 tabs with specific names. Now I also have 5 mxml components with the same names as the tabs (that is the names of the mxml components are same as the tabs, that is Tab1,Tab2 etc. The non-dynamic way would be to use myTab1:Tab1 = new Tab1();myTab1:Tab2 = new Tab2); etc. Thus I will have to do this for each tab which I don't want.
What I want to do is to load the mxml components in each tab while I am looping through the Array. Hope I am clear enough.
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.containers.VBox;
import mx.controls.Label;
import mx.events.FlexEvent;
import spark.components.NavigatorContent;
protected function tabNavigator_creationCompleteHandler(event:FlexEvent):void
{
var superModules:Array =["Tab1","Tab2","Tab3","Tab4","Tab5"];
for each (var superModule in superModules)
{
var myNavigatorContent:NavigatorContent = new NavigatorContent();
myNavigatorContent.percentHeight = 100;
myNavigatorContent.percentWidth = 100;
myNavigatorContent.label = superModule;
myNavigatorContent.addChild(superModule as DisplayObject);
tabNavigator.addChild(myNavigatorContent);
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:TabNavigator id="tabNavigator" width="100%" height="100%" creationComplete="tabNavigator_creationCompleteHandler(event)">
</mx:TabNavigator>
</s:Application>
Can somebody help on achieving this.
Many thanks.
Yes you can do it.Please find my solution below.
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
<fx:Script>
<![CDATA[
import mx.containers.VBox;
import mx.controls.Label;
import mx.core.IVisualElement;
import mx.core.UIComponent;
import mx.events.FlexEvent;
import spark.components.NavigatorContent;
/*The class "Tab1","Tab2" not compiled with the application
because the linker and the compiler do not add classes
that are not referenced in the code.
Even though you’ll never use the _dummyVarToAddTabToAppCompilation1
variable it is necessary to use that line to instruct the compiler
to include Tab1,Tab2 in the compilation.*/
private var _dummyVarToAddTabToAppCompilation1:Tab1;
private var _dummyVarToAddTabToAppCompilation2:Tab2;
protected function tabNavigator_creationCompleteHandler(event:FlexEvent):void
{
var superModules:Array =["Tab1","Tab2"];
for each (var superModule in superModules)
{
var myNavigatorContent:NavigatorContent = new NavigatorContent();
myNavigatorContent.percentHeight = 100;
myNavigatorContent.percentWidth = 100;
myNavigatorContent.label = superModule;
// Convert class name to Class object.
var cls:Class = getDefinitionByName(superModule) as Class;
// Create a new instance of the class.
var instance:UIComponent = new cls();
myNavigatorContent.addElement(instance);
tabNavigator.addChild(myNavigatorContent);
}
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<mx:TabNavigator id="tabNavigator" width="100%" height="100%" creationComplete="tabNavigator_creationCompleteHandler(event)">
</mx:TabNavigator>