How to emulate a "Paste" in Selenium IDE add-on for Firefox? - facebook

With the help of the Selenium IDE add-on for Firefox, I'm trying to publish a post on Facebook that will include a link, the post should also contain the usual 'link preview' (image and/or description text) scraped from the website I'm sharing.
For this purpose I played around with the following commands to no avail: "type" ; "typeKeys" ; "SendKeys"... the result was actually expected because these commands mimic typing, and if you manually write a link (by typing it) while trying to publish a post on Facebook - the "link preview" (image and/or description) won't be loaded. I also tried to emulate pressing "ctrl + [a/c/v]" in 3 separate commands as a workaround after the link as a text was written in the 'update your status' field, but no luck with those. See the visual examples below:
Selenium IDE contains:
Store | https://9gag.com/ | link
[[bunch of irrelevant commands in-between]]
typeKeys | class=_1mf _1mj | ${link}
Result:
Screenshot 1 - imgur
If you publish the post this way, it'll end up like a plain text. Not a valid share. The thing I'm trying to achieve with Selenium IDE is what's shown on the screenshot below. You can achieve it by copying some absolute URL and pasting it (ctrl + v) inside the 'update your status' window on Facebook.
Result:
Screenshot 2- imgur
Important: Workarounds are welcome as always, but here's what's not welcome as a workaround from other off-topic non-Selenium related reasons:
Using this sharing form: facebook.com/sharer/sharer.php?u=[absolute URL you want to share]
Using the mobile/touch version of Facebook
Thank you in advance for your time, and for the potential solution.

You could try using a space or enter at the end of the URL.

Related

Print text with clickable link in console or terminal in Perl [duplicate]

How do I display a hyperlink (weblink) in hudson/jenkins build output console?
What I'm trying to achieve is, during a hudson/jenkins build based on certain condition, I would like to display a hyperlink.
When a user click on that link, it should open a new browser window and show the page.
Is there a plugin to do this? Any suggestions please?
When using a (system) groovy script or Jenkins job pipeline (without sandbox) you may want to try e.g.:
import hudson.console.ModelHyperlinkNote
println hudson.console.ModelHyperlinkNote.encodeTo('http://example.com', 'example')
Please find the full API of hudson.console.ModelHyperlinkNote here:
http://javadoc.jenkins-ci.org/hudson/console/ModelHyperlinkNote.html
If you enter, for example:
echo 'http://example.com'
in a Build step Execute shell → Command the address will be hyperlinked in the Console Output, though not with target="_blank". But middle-clicking on it opens it in a new tab or window – depending on your browser preferences.

Silent printing on clients printer for a hospital front desk ADF project

I am working on a Hospital front desk ADF project, here I need to generate visit slips these dont require print preview.I want to get to print the slips without any print dialogs nor do I want a popup window. I tried lot of stuff found on the net but nothing solid has come up..
Tried this.print on the Jasper report, tried the same through Java but I am getting dialog.
I am working on an intranet so the security aspect is out of the discussion so how so I make this work?
This is a suggestion rather than an answer, but I can't write comments before I get 50 points of reputation (thank you for the warm welcome, StackOverflow!) - maybe one of these will help:
1) Printing an html file using java without showing print dialog to the user
2) How would I suppress the print dialog in this example?
I was able to perform the silent print, I used a popup window to call a servlet which generated the required visit slip and displayd the same on the pop window. For the silent print I used
exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT, "this.print({bUI: false,bSilent: false,bShrinkToFit: true,printParams:this.getPrintParams().constants.interactionLevel.silent});this.close();");
I had to make a couple of changes to IE, I added my url to the trusted site option in IE. I enabled js in acrobat and also pointed acrobat to the trusted sites in IE. This resolved silent print but am stuck with another issue..
I am not being able to close the window once print is done.. I tried this..
"var win = window.open('PrintPopUp.jsf','_blank',\"height=300,width=200,scrollbars=no," +
"status=no, resizable=no, screenx=0, screeny=0\");win.onclick=function(){setTimeout(function(){win.close();\n},9000);}
But its not working in IE 11.. any suggestions?
Well I found out a way to do this..
JRPdfExporter exporter = new JRPdfExporter();
exporter.setParameter(JRPdfExporterParameter.PDF_JAVASCRIPT,
"var pp = this.getPrintParams();pp.interactive=pp.constants.interactionLevel.silent;pp.NumCopies=1; this.disclosed= true ;this.print({bUI: false,bSilent: false,bShrinkToFit: true,printParams:pp});");
This adds pdf javascript to the generated pdf..
Once the pdf is displayed on the popup page it performs the silent print.. Hope this helps someone in the future..

Fluentautomation with multiselect

I am having trouble selecting multiple values from a SELECT box via FluentAutomation.
Sample test case:
I.Open("http://www.htmlcodetutorial.com/forms/_SELECT_MULTIPLE.html");
I.Select(1).From("select[name='toppings']");
I.Select(2).From("select[name='toppings']");
I.Select(3).From("select[name='toppings']");
When this code is executed only the 3rd option is selected, whereas I would like all 3 options to be selected (This would be equivalent to a user holding down ctrl and clicking the 3 options).
This has been tested with Internet Explorer (v11.0.9600.17728) and Chrome (v42.0.2311.90)
Any insights would be appreciated.
Thanks.
I believed what you want is this:
I.Select(1,2,3).From("select[name='toppings']");
See the documentation here:
https://github.com/stirno/FluentAutomation/blob/b084f3e2638edf0a169f4286628706f042dc9339/Docs/v2/actions.select.md
Edit
It appears that there is a bug in the older version of Chrome WebDriver. Because FluentAutomation bundles the Chrome WebDriver in FluentAutomation.SeleniumWebDriver.dll, you must compile this on your computer (instead of using nuget):
Download the latest Chrome WebDriver: https://sites.google.com/a/chromium.org/chromedriver/
Download FluentAutomation source: https://github.com/stirno/FluentAutomation
Go to "{source path}\FluentAutomation.SeleniumWebDriver\3rdPartyLib\" and replace chromedriver.exe with the one downloaded in 1
Recompile FluentAutomation and use the compiled FluentAutomation.SeleniumWebDriver.dll instead of the one you got from nuget.
Good luck!
Edit 2
There is a way to override FluentAutomation's ChromeDriver. See #stirno comments below.

Intellij Idea plugin - possibility to click on an link of class/file to open it

Could you please suggest how is it possible to implement the next thing : when the user clicks on the file name/line number, the editor is switched to that file.
P.S. The source code is available there.
Check the following classes/methods:
com.intellij.execution.filters.TextConsoleBuilder#addFilter
com.intellij.execution.filters.RegexpFilter
Usage example:
org.intellij.lang.xpath.xslt.run.CustomRegexpFilter
org.intellij.lang.xpath.xslt.run.XsltRunConfiguration#getState
See also Output Filters Dialog help section.

Can't see dynamically loaded code in Chrome Developer Tools 22

When I dynamically load a snippet of html containing javascript via AJAX, I cannot see that content in the source tab in the developer tools window in Chrome 22.0.1229.94. Tellingly, I went here
https://developers.google.com/chrome-developer-tools/docs/scripts-breakpoints#js_dynamic
This page shows an example developer tools window which is out of date. There is a button on the page to load a dynamic script and it does not show up in the source tab when you do.
As a work-around, I have found that adding
debugger;
to the script and reloading it will cause it to pause in the dynamically loaded code, but unfortunately, all the line numbers are greyed out and you can't set any breakpoints within the debugger.
Am I missing something here or what?
Thanks,
Rob
When you use a library or javascript code that you have loaded it dynamically, you can use the phrase
//# sourceURL=foo.js
at the beginning of your javascript code that foo.js is the name that will be assigned it. debugger will show it with that name.
This is true in chrome, and I think in firebug too.
In this case you can place a breakpoint in the dynamically loaded javascript code.
Possible duplicate of:
Is possible to debug dynamic loading JavaScript by some debugger like WebKit, FireBug or IE8 Developer Tool?
Don't know if this works or not in chrome (This definitely doesn't work for me now, may be in the past).
//# sourceURL=foo.js
Working Solution
For your dynamically loaded script via ajax to appear in your chrome source tool, you need to add the following line at the start or end (I prefer) location of your script file:
//# sourceURL=foo.js
And your script with name foo.js will appear at the left pane of source tab under (no domain) dropdown
->localhost
-- source/src
->(no domain)
-- foo.js
Alternatively you can add the below line in your script anywhere between the scripts.
debugger;
In chrome, you can use " debugger; " statement to break at a statement when debugger panel is open. Chrome will simply ignore this if the debugger panel is closed.
This will help stop your script in debugging mode and you will see your script in source (debugging) panel with name like VM****.
Hope this helps.
You can use //# sourceURL. Chrome doesn't seem to be supporting //# sourceURL for inline scripts. However, it does work on eval expressions. This article gives more details about naming eval blocks and naming of any anonymous functions in your code.
Instead of using eval, you can try embedding a script tag or JSONP may be.
Varunkumar Nagarajan
for me it happened on nodejs project.
i restarted server and open in new tab my app and tada!..
Alternatively, to fix this problem you can open developer tool in a seprate window by clicking the icon. Now reload your script, and it will shown in script tab as expected. I know this is not a solution but a work arround.