How to overcome pop up shile replaying recorded Selenium IDE - html

I recorded application in selenium IDE HTML format after replaying this is the error that is displaying "Firefox prevented this site from opening pop up window"
In selenium IDE in log we got error like this "[warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank54652"
how do i solve this problem?

Give that window a name, example:
window.open('url', 'name_here', 'more_options');

Related

Chrome devtools erroneously pauses on exception in ignored script

Image speaks for itself; this script is on the debugger's ignore list; yet every time I trigger this exception it is paused upon. I cannot uncheck Pause on caught exceptions because I am trying to pause on a caught exception in another startup script.
Devtools says The debugger will skip stepping through this script, and will not stop on exceptions, but it's doing just that, it is not skipping this script.
I've tried several things, like unignoring/reignoring. Using canary, etc. I have this problem on both my windows and osx machines; so it doesn't seem to be particularly related to my environment.
I am wondering if anyone else has run into this and found a workaround. Thank you.
Problem remains unsolved. Leaving this post here with some unsucessfull tentatives of mine, so someone can build something based on them.
1. Devtools extension API
It is possible to create an add-on that can reach the Developer Tools window and even reach the Sources tab, but once there all I could do was creating new sidepanels or attaching a listener to code text selection changes: chrome.devtools.panels.sources.onSelectionChanged.addListener((x)=>{console.log("onselectionchanged");console.dir(x);});
This API was not enough, could not reach debug status or any interesting sidepanel.
2. Debugging the debugger with a JS debugger
By hitting ctrl-shift-i or ctrl-shift-j over a devtools debug window it is possible to open another devtools debug window, debuging the first one. From there it is possible to write code that detects the banner informing that the file was supposed to be ignored and then click on the continue button:
function breakpointskipper() {
bnr = document.getElementById("sources-panel-sources-view").querySelector("div.vbox.flex-auto > div > div > div > div.flex-none > div");
if (!bnr) return;
bnr = bnr.shadowRoot;
if (!bnr) return;
bnr = bnr.querySelector("div");
if (bnr.ariaLabel != "This script is blackboxed in the debugger") return;
btn = document.querySelector("div.scripts-debug-toolbar.toolbar");
if (!btn) return;
btn = btn.shadowRoot;
if (!btn) return;
btn = btn.querySelector("div > button[aria-label=\"Resume script execution\"]");
if (!btn) return;
btn.click();
}
It is possible to even attach this breakpontskipper() button presser to an event in the devtools window and automate things, but as soon as you close the debugger being debugged window, it is all over and you have to recreate the code and reattach again. As said before, I wasn't able to make any add-on reach here.
3. Debugging the debugger with a native debugger
One last available option would be using GDB to debug the DevTools and change its behavior, in the chromium documentation it is shown that they have debug symbols available but I didn't try this approach.
Please try the troubleshooting help, and share some feedback. Also it would help greatly if you pasted some script here.
Please check if your script black boxed like here
Did you accidentally turn on - break on all exceptions see here
Force a hard refresh, i.e. clear you cache like here
Turn off all break points, then do a restore, try again.
More from ref. on chromium bug site
Update 1: Can you please verify/double check that your file to ignore is actually added to the ignore list.
If you know upfront which files to ignore, head over to Developer Tools > Settings (Cog Icon) > Ignore List. Then add a file name or regex pattern you wish to exclude.
You should see something like

Taking full page screenshot with a Chrome extension

Is there away to capture a screenshot of the full page, including what is below the fold, in a Chrome Extension?
The captureVisibleTab seems to be limited to what is displayed within the visible area.
The standard approach seems to be to scroll around the page and capture screenshots at each part and then stick them all together. The official google screen capture plugin does this, but I found it to be buggy (at least on Mac OSX), so I wrote my own full page screen capture extension.
Source code here (relevant code in page.js and popup.js).
On Macs, while not a Chrome extension, you can use the following AppleScript to automate the process found here:
https://zapier.com/blog/full-page-screenshots-in-chrome/
tell application "Google Chrome" to activate
tell application "System Events"
keystroke "i" using {option down, command down}
delay 0.3
keystroke "p" using {shift down, command down}
delay 0.3
keystroke "Full"
delay 0.5
key code 76
end tell
Open ScriptEditor and paste that script in. Save it as a file wherever you need it locally. When you run it by pressing play in ScriptEditor, it will automatically save a full screenshot of the active tab to your Downloads folder.
Chrome 59 adds a new feature in DevTools called Capture full-size screenshot. But I don't know whether this API can be called by extensions.
You're limited to capturing the visible page via captureVisibleTab unless you use Flash or NPAPI.

accessing a chrome extension from outside the browser

Is it possible to access a Chrome Extension from outside the browser?
I would like to be able to run a command from my text editor (MacVim) that refreshes the page on which I am working. From reading the Chrome Extension documentation it looks like I could try something really hack-y, like opening a page that uses Chrome message passing to refresh another page, but there does not seem to be a strait-forward way to do this.
I am running Mac OS X. I've tried the shell command:
$ open <url>
But that opens a new tab every time in Chrome, so this doesn't help when I'm using the developer tools
You are right, there is no straight forward solution.
Your hacky approach is the simplest way to go. Only instead of messaging I would put a tab creation listener into background page, and when a tab with some special URL is created (http://example.com/?do=refresh) - close it and refresh the next selected tab. You will see new tab flickering, but that's as good as it gets.
You can also look into using WebSocket API, for which you would need to write a server side app (which you need to call from your editor somehow). Not sure how this all might turn out.

Is there an alternative to watir::ie.attach for watir-webdriver since attach is not supported on webdriver

I have a website which is only rendered in Webkit enabled browser (Google Chrome, Safari). I am using Google Chrome since I am on Windows 7.
I am using Watir-WebDriver to automate the same.
Issue: When I click on a button on the browser window, is launches another window and post click content is rendered in the new browser window. I need a way to be able to Identify this new browser window, in-order to be able to proceed with my testing. I have been reading on various forums, but not getting any certain answer/solution.
Q: Is there an alternative to watir::ie.attach for watir-webdriver since attach is not supported on Watir-Webdriver
Sample code:
require "rubygems"
require "watir-webdriver"
require "selenium-webdriver"
b = Watir::Browser.new(:chrome)
website = "http://xyz.com"
#a new browser is launched and the website is opened
b.goto(website)
#this opens a new browser window
b.link(:xpath,"/html/body/div/ul/li/a").click
#there is a button called "MAP" on the new browser window
b.link(:id,"btn_MAP")
#this gives an error, unknown link
"window" method is the alternative for ie.attach. Webdriver can handle the window opened by itself with window method.
b.link(:href,/server\/getPage/).click
b.window(:url,/server\/getPage/i).use do
b.link(:id,"btn_MAP").click
end
you can handle popped up windows in the window method block. If you want to keep handling popped up window, use it without block, like window(:url,/foobar/).use
see also:
http://groups.google.com/group/watir-general/browse_thread/thread/232df221602d4cfb
#Yutaka: Thanks a lot for all your help it lead me to use something like the following and it worked!
b.link(:xpath,"/html/body/div/ul/li/a").click
c = b.window(:url,"http:\/\/server\/getPage\/67\/1354")
c.use
b.link(:id,"btn_MAP").click
have you tried making the website the default homepage for the browser?
that might prevent you from having to do an attach.

Creating Chrome popup with a C++ program

Problem context:
I have a C++ program and a web presence. Currently the way things are working I have made a control panel with javascript and html. And it send commands via an unimportant communication medium to control things or get information from the C++ program.
Now, when the C++ program launches, I'm making it run a
ShellExecute(NULL, "open", addressBuffer," --new-window", NULL, SW_NORMAL);
This is a way of launching the default browser with the given address. The addressBuffer in this case points to an intermediate HTML file that quickly turns around and uses the
window.open()
in Javascript to open the final popup, then closes itself.
The result is the user now has the popup control panel that I want them to have but the user's main browser window also gets given focus, un-minimized, and placed on a different tab than the one they had selected. (Basically pops up out of nowhere and selects a another tab)
Problem:
I'm looking for a way to launch a Chrome popup, without disturbing a previously open browser window. Any ideas or solutions would be very helpful.
Lastly, it's worth noting that the " --new-window" from the code above doesn't actually open a new window like you would expect. In this case it's actually doing nothing... If it did work, none of this would really be an issue.
I know this is wordy so thanks in advance for you time!
-Michael
Alright, I came up with a solution.
Something about how ShellExecute processes it's commands was preventing the command line args to be passed in correctly.
My work-around includes grabbing the path to Chrome from the registry,
HKET_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe
Then simply doing a system() command with the chrome path "--new-window" and the web path.
Then I let the intermediate html page open it's popup and close itself.
Tada done.
Thanks.