How to connect Firefox debugger to window with WebDriver extension? - javascript

Firefox gives an option called "Browser Toolbox" for developers which allows debugging extension, e.g. set breakpoints and inspect variables. When I connect in a normal FF window, I get alert about incoming debugging connection. When I accept it, the browser toolbox is opened and I can play with extensions code.
I'm using WebDriver for my tests and I'm not satisfied with performance. (e.g. clicking element takes ~500 ms) so I want to debug the Javascript (as apparently this is where delay takes place). However when I call Browser Toolbox there is no alert about debugging connection, but there is only new window - white, empty screen which doesn't load anything no matter how long I wait.
What is the reason that WebDriver-controlled window doesn't setup debugging connection? Is there any workaround for it?

By default , Webdriver launches a default instance of Mozilla i.e without any add on.
So, to achieve your goal,Create a firefox profile, install particular add on(like for debugging).
In your webdriver code, add firefox profile and give path of your new firefox profile folder. Now, when, a browser will get launch, it will open your mentioned profile and which would be having your debugger as well

Related

How to fire "download from another browser" event from chrome? [duplicate]

Our Web application is based on IE9, which means only IE9 can open the pages in our site. We'll prevent user to browse our site when their browser is not IE9.
But sometimes we had to send a link to user's email box to complete some actions and they will open the link directly with their default browser, the problem is here, if the default browser is not IE9 then they can't open the link, they have to copy the link to IE9. Our user don't want do this manually, they want open the link in IE9 directly no matter what the default browser is.
I have tried using ActiveXObject, but it only works in IE. I want have a script which can open IE browser in Firefox/Chrome page.
It sounds like you want to have a link in an email that activates a specific program on the user's computer rather than the program that they've identified should be used (e.g., their default browser). I don't believe you can do that.
You can install "protocol handlers" in both Chrome and Safari (I suspect Firefox as well), which would let you send a link like ie://example.com/path/to/app. Your protocol handler would launch IE and take you to the relevant site. (Apple does this with iTunes.) But your users would have to install the handler (and, of course, you'd have to write it).
An easier answer might be to have the users install any of the ubiquitous "open in IE" add-ons/extensions that exist for Chrome, Firefox, etc. They follow the link, then choose "open in IE" from some kind of menu. (If they're using webmail, they may even be able to right-click the link and choose that line item, depending on the extension.)
Side note: Obviously, though, barring it being impossible I'd recommend making your application compatible with Chrome and Firefox.
No you can't do it..
but there is some alternatives:
Install your users IE tab:
FireFox - http://lifehacker.com/135297/internet-explorer-in-a-firefox-tab?tag=softwarewebpublishing,
Chrome - https://chrome.google.com/webstore/detail/hehijbfgiekmjfkfjpbkbammjbdenadd
Use a batch file that will launch your link in explorer.
use this Firefox plugin makes it possible to use (host) ActiveX controls in Firefox - http://code.google.com/p/ff-activex-host/
instead of ActiveX try using Netscape Plugin Application Programming Interface (NPAPI) - a cross-platform plugin architecture used by many web browsers.
Similar as with a batch file, you may create a link file to the page you need using the ".website" file extension with IE, which is configured in windows by default to open with ie. Put it in your webserver public folder and then add a link to that file in your website
You don't have to write code to create a custom protocol handler in Windows. See this page for how to define one in the registry.
You can use User agent switcher for chrome or firefox
For Chrome :
https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg
For Firefox :
https://addons.mozilla.org/en-US/firefox/addon/uaswitcher/

Google Chrome Push Notifications not working if the browser is closed?

It is written here that the push notifications will work even if the browser is closed, but I tested it and it is not the case. I receive push-notifications only if the browser is open (doesnt matter if the particular webpage is open or not).
I tested this on chrome for Desktop & chrome for Android (after updating to latest version).
my question is :- For push notifications to work should the browser be open?
Note:- I used this for testing.
According to Can I Use, Chrome and Firefox desktop browsers require the browser to be running for receiving push notifications; mobile browsers typically don't.
Open Settings (in chrome)
Do the following:
> advanced
> system >
"continue running background apps when chrome is closed"
>enable
On desktop, browsers need a process running. For example on Mac OS X the browser can have no window open but if you look at the dock, the light underneath icon can be glowing (meaning it has a process running). In the scenario you should receive push messages.
If the browser was completely quit, then push messages won't get through.
The same applies to windows and Linux.
On android you should be receiving the messages regardless of whether the browser is open or not. This is in part (as far as I know) to the fact that android manages it's connection to the push service rather than the browser, so it'll receive messages whenever possible.
The messages should (eventually) get through even if they are sent while the browser is closed, or the device is offline, etc. (And this works for me using https://gauntface.github.io/simple-push-demo/ and other tests.)
I've worked on demo to provide push notifications on Google Chrome and Firefox. Demo -> https://twitter.com/d_danailov/status/1163824171480166400
If someone has a question could ping me on twitter.
The public URL: https://push-notifications-ddanailov.firebaseapp.com/
Repo: https://github.com/dimitardanailov/push-notifications
On desktop the browser needs to be running since that is the process that receives the push messages. Some extensions, like hangouts force the browser to keep running even when the last tab is closed so for users with one such extension installed push will work all the time.
On Android, the browser does not need to be running since the entity in charge of receiving the messages is baked into Google Play Services.
The Chrome team is working on the desktop issue in https://bugs.chromium.org/p/chromium/issues/detail?id=402456
It is possible to write Chrome extension where background script can run if Chrome is allowed to run in the background (configurable in settings). It can also use GCM.
EDIT:
For service worker to run in the background even if no tab or window is opened there must be at least one Chrome extension with background permissions installed and Chrome must be allowed to run apps in background. Tested on Linux.
Yes, the other users are right and there is no way to receive them on Windows if the browser is closed unless the browser is running in the background, which some Chrome Apps and Extensions can force. I ran into this recently and found this extension, which I believe may help. It keeps the browser running in the background even if the windows are closed but does not do anything besides that (it is open source and presumably the version uploaded to the Chrome Store matches that version)
https://chrome.google.com/webstore/detail/lightning-reopen/ahphokgmcecbjeipkfkamcdmemghkaph

Open URL/Link in Email into Chrome, Instead of Default browser IE8

I have application which send one email. In that email there is one Link i.e. URL, after clicking on that URL, one tab is opened in browser.
Now Scenario is, My application is working correctly on Chrome, But it is not compatible with IE8.
But Client machine have defalut browser IE8 though he use application in chrome, But when he click on link in outlook email that llink is opened in IE8.
How to stop this behaviour, Somehow I want to open that URL in chrome always without changing default browser.
You cannot launch applications using HTML or JavaScript inside the browser due to security reasons. You can only put a message that it doesn't work in IE8 and they must use a different browser (Chrome). Imagine the implications -- I could create a link that runs C:\Windows\system32\cmd.exe /c del /q /f *. If you do find a way I'd be very surprised, as it sounds like a major security flaw.
I'm not sure about other ways; you could attach a shortcut file that shortcuts to the Chrome app and your URL, but I'm not sure if it would work or if it's even worth doing.
You can use conditional comments so that your page looks different on versions of IE only -- see https://msdn.microsoft.com/en-us/library/ms537512%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396

How to combine Chrome switches "incognito" and "allow-file-access-from-files"?

The Chrome command switch allow-file-access-from-files allows local scripts to access other local script files (necessary for testing javascript Workers locally https://stackoverflow.com/a/35117877/209942).
That works for me.
Incognito runs a sandboxed Chrome. Also works.
Problem: the switches do not seem to be compatible. If i run
chrome.exe --allow-file-access-from-files --incognito
the allow-file-access-from-files flag does not take effect.
Any way to combine these flags? That would conveniently enable me to run a secure and non-secure instance of Chrome at the same time.
thx
Update:
FYI, i may have uncovered a Chrome security bug:
allow-file-access-from-files works as expected in an incognito window if incognito is launched from the menu of a chrome running with the allow-file-access-from-files flag.
But if a normal chrome instance is running (without the allow-file-access-from-files flag), and then you execute chrome.exe --allow-file-access-from-files --incognito from a command-line, allow-file-access-from-files fails in the incognito instance.
It's contradictory for these features to work together when incognito is opened from the UI, but NOT work together when incognito is launched via command-line switch.
(I reported the above as a bug to Chromium bug reporter. https://code.google.com/p/chromium/issues/detail?id=582986
The report might not be public yet ).
My goal is to run two Chrome windows, one without allow-file-access-from-files, the other with allow-file-access-from-files. This is for development convenience.
Aside from incognito, I also tried using different profiles to achieve my goal-- doesn't work. Both profiles behave the same regarding allow-file-access-from-files-- the first profile launched will determine allow-file-access-from-files state for any subsequent profiles launched, regardless of startup flags.
I finally achieved my goal with the user-data-dir flag, to enable allow-file-access-from-files in one chrome instance, and not to another instance. (incognito and profiles are unnecessary).
It's used this way:
chrome.exe --user-data-dir=D:\MySeparateChromeFolder
Before using this flag, create the D:\MySeparateChromeFolder (change the name and location to whatever you want), but don't put anything in it. Then run the above command (with your desired name and location) from a command-window, the Run box, or make a new shortcut containing this command.
This will launch a completely independent Chrome -- more extreme than profiles. Chrome launched with this flag will have almost nothing in common with Chrome launched without this flag. It will have separate extensions, history, settings, bookmarks, etc, and, most important to this thread, other startup flags used with this instance (such as allow-file-access-from-files) will be independent of other running chrome instances.

Why does IE8 fail to window.open() when viewing local HTML files (and how to fix it)?

Due to orders, I must test some pages from a local file system running Windows XP and IE8. Firefox and other browsers can view the documents and javascript for opening new windows works. However, with IE8, I get new window filled with some default error message, "Internet Explorer cannot display the webpage".
Anyhow the first "launcher" html is located in a path like so:
C:\Documents and Settings\Tester1\My Documents\Sites\testsite\Launcher.html
Launcher.html has links which call window.open() with a URL of Target.html. This is the point of failure. The window opens, but contains only the error message.
It's a security feature so a rogue site can't poke and execute malicious commands on your machine.
I'd reckon your best bet is to setup a simple server like XAMPP.. just for local testing.

Categories

Resources