I am using Selenium IDE Record function to create test cases.
I would like to take screenshot at some part of application that I am testing.
Using UI of Selenium IDE it is easy:
Command: captureEntirePageScreenshot,
Target: *path for screenshot*
But it is not convenient to manually type this (or copy paste) every time I want to take a screenshot, so I decided to make a plug-in (a button on the Selenium IDE toolbar) that will add this screenshot command to the testcase, once I click on it.
I created my button, which is visible on the toolbar, but right now it does nothing:
<?xml version="1.0"?>
<?xml-stylesheet href="toolbar.css" type="text/css"?>
<overlay id="toolbar_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="toolbar2">
<toolbarseparator id="screenshot-separator" insertafter="record-button"/>
<toolbarbutton id="screenshot-button" insertafter="screenshot-separator" label="Take a screenshot" class="icon" tooltiptext="Take a screenshot" command="*problem_is_here*"/>
</toolbar>
</overlay>
I was digging through Selenium IDE source code, but didn't find method that can be used to add new command to the test case...
Did more digging through source code and find required method:
Editor.addCommand(command, target, value, window, insertBeforeLastCommand)
So my final .xul file looks like this:
<?xml version="1.0"?>
<?xml-stylesheet href="toolbar.css" type="text/css"?>
<overlay id="toolbar_overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="toolbar2">
<toolbarseparator id="screenshot-separator" insertafter="record-button"/>
<toolbarbutton id="screenshot-button" insertafter="screenshot-separator" label="Take a screenshot" class="icon" tooltiptext="Take a screenshot" oncommand="window.editor.addCommand('captureEntirePageScreenshot', 'C:/Users/username/screenshot'+window.FileUtils.getTimeStamp()+'.png', '', window.editor.window);"/>
</toolbar>
</overlay>
Look inter user-extensions.js. This is an easy way to add javascript functionality.
To me, it seems silly to reproduce a command that already exists.
With the IDE's autocomplete, I'm not sure why it's complicated to add in this step, unless you want to use it like the right-click menus?
Related
I am writing a Plugin for intelliJ IDEA and I have been trying to add a button in the main toolbar, besides the run button:
I have been looking for guides to help me do it, but I haven't found any. It has to be possible, this is just my first plugin and I lack the necessary experience. Any help is greatly appreciated.
It's simple. You have to create an action (descendant of AnAction) and put it in Actions tag within your plugin.xml:
<actions>
<action id="your.action.id" class="your.Action"
text="Some label" description="Action description" icon="AllIcons.General.AddJdk">
<add-to-group group-id="ToolbarRunGroup" anchor="first" />
</action>
</actions>
The "add-to-group" tag will tell IDEA to put it together with other execution related buttons.
I am following this tutorial http://www.vogella.com/tutorials/EclipsePlugin/article.html#exercise-adding-e4view-based-parts-to-3-x-based-applications . When I'm trying to right click in extension tab to add a new e4View as shown in a tutorial, nothing happens, the popup menu doesn't appear. Is it possible to create this view in different way?
You can always edit the plugin.xml directly by clicking on the 'plugin.xml' tab.
A basic e4view would look something like:
<extension
point="org.eclipse.ui.views">
<e4view
class="testview.E4view1"
id="TestView.e4view1"
name="name"
restorable="true">
</e4view>
</extension>
When using an XUL <textbox> element in the latest Firefox releases, I am not able to focus the element and write something into it. It worked in older versions, like 33. Using html:textarea instead seems to work. However, I would be happy to keep the original XUL element in my app and want to understand what is going wrong here.
When using the multiline attribute on the <textbox> element, the element is not visible at all!
Any hint or explanation would be great.
Here is my small test.xul file content:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html = "http://www.w3.org/1999/xhtml"
width="800"
height="800">
<textbox flex="1" />
<html:textarea flex="1" />
</window>
Found the problem.
I had an override rule in my chrome.manifest file which looked like this:
override chrome://global/locale/textcontext.dtd
chrome://myapp/locale/xulrunner_global_textcontext.dtd
The file was changed for firefox 38 and an additional ENTITY was added which is not defined in my file. Adding the missing ENTITY solved all problems.
Thanks Makyen for testing and inspiration.
The changes for those who are interested:
https://hg.mozilla.org/releases/l10n/mozilla-beta/de/diff/6f25b6d2dcf5/toolkit/chrome/global/textcontext.dtd
I would like to add an icon/button next to reply button in MOZILLA THUNDERBIRD. What should I write in XUL file so that icon in message header will be shown?
You should read https://developer.mozilla.org/en/docs/Building_an_Extension which applies to Firefox, but is largely valid for Thunderbird. Once you get to the part where you're supposed to overlay the interface, read https://developer.mozilla.org/en/docs/Building_an_Extension to figure out that you need to look up msgHdrViewOverlay.xul http://mxr.mozilla.org/comm-central/source/mail/base/content/msgHdrViewOverlay.xul . Use the https://addons.mozilla.org/en-US/thunderbird/addon/6622/ DOM inspector addon to find the ID of the element that you need to overlay. Possibly use the demo addon at https://developer.mozilla.org/en-US/Add-ons/Thunderbird?redirectlocale=en-US&redirectslug=Extensions%2FThunderbird to get started, although you will most certainly need to overlay a different part of the Thunderbird interface.
The .xul-file will look something like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css"
href="chrome://YourExtension/content/YourButton.css"?>
<overlay id="YourExtension-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://YourExtension/content/YourButton.js"/>
<toolbarpalette id="MsgComposeToolbarPalette"> // Button available in compose message only
<toolbarbutton id="your-button-1"/>
</toolbarpalette>
<toolbarbutton id="your-button-1"
label="Track"
tooltiptext="Description by mouseover"
oncommand="YourJSFunction()"
class="toolbarbutton-1 chromeclass-toolbar-additional YourButton"
/>
</overlay>
Want to know more? You can learn how to create a custom button HERE.
I've created an eclipse plugin which extends JSDT. When editing a JavaScript file, pressing Ctrl-Space shows "Default Proposals", consisting of general JavaScript Suggestions. Pressing Ctrl-Space again shows "Template Proposals", but the list is empty. How do I add content to the "Template Proposals" list?
You can use the org.eclipse.ui.editors.templates extension point for this. Something like this:
<extension
point="org.eclipse.ui.editors.templates">
<template
autoinsert="true"
contextTypeId="javaScript"
description="Do something"
id="com.foo.mytemplate"
name="A silly template">
<pattern>
fafdsds fafdsda fdadsa
</pattern>
</template>
</extension>