I tried using phantomjs to load a website
http://kissanime.com/Anime/Flag/Episode-001
But this website have some block even if I use phantomjs useragent as mozilla firefox, then I try using lynx browser but its unable to render javascript in the page, thus I decided to use SpiderMonkey which said to be able to render webpage with javascript and act as a browser.
But how to use SpiderMonkey to curl the site and output the content as 1.html
Have a look at http://slimerjs.org it's a Phantomjs port on Gecko.
Related
The following is the code I used to launch qtp, It is working well with IE but not in chrome.
What are the changes I shd Make to open through Chrome
var qtApp = new ActiveXObject("QuickTest.Application");
qtApp.Launch(); // Start QuickTest
qtApp.Visible = true;
Microsoft's VBScript is integrated with COM and UFT also exposes a COM interface, this is why you were able to launch UFT from HTML using VBScript. However VBScript is not supported by Chrome and JavaScript is not integrated with COM (at least not Chrome's JavaScript).
Therefore I don't think there's a simple way to launch UFT from an HTML page using Chrome. It is possible if you write a Chrome Extension but I don't think this is worth the trouble.
One way to do it will be to create an ASP.Net website, ASP.net will support opening UFT using the COM interfaces. I am doing the same thing for ALM's OTA API.
I have a Python program that uses BeautifulSoup to extract some data from a website.
In Google Chrome, there is this option called the Developers Console; it is used to execute javascript commands live right on the webpage.
Is there a way, or a work-around-of-a-way to execute javascript commands remotely using Python? Like casting a webpage to an object and running a javascript command in the background (without launching a new Chrome window)?
You can use Native Messaging API to communicate between a shell script and the browser.
You can also launch Chrome or Chromium with --headless flag set. See also puppeteer.
How do i debug javascript in opera mini?
I have already installed opera mini emulator.
can someone help me how do i debug javascript remotely with dragonfly (firebug equivalent of opera)?
My script does in work in all other browser but not in opera mini
Opera Mini supports console API like this:
server:console?post=http://url/to/your/script
OR
You can dump your log data to source and get source using this command(this fill display source code of current/last page for your device):
server:source
OR
Use remote console services like jsconsole.com. You add script tag with jsconsole script and key. After this use this key on jsconsole site to get the log.
NB: jsconsole script rewrites console.log calling via ajax request
There is, at least for now, no support for debugging a javascript directly in Opera Mini.
You can use document.write to output progress/debug messanges, that is about the extent of debugging posibilities.
Could you point to the script, or at least describe what it is trying to do?
Opera Mini is fairly different from a normal browser, scripts are run on the transcoding servers, and the result of the run is then passed to the client, which can not in fact run scripts.
The client can then pass on clicks and some other events to the script when the user interact with the page, which might change the state/look of the page on the server, which is then sent to the client.
Can I run my own javascript code in a browser when viewing a page?
For example I have page index.html. In that I want to run this javascript function
function myFunction()
{
alert("Say Hi");
}
I want to call this function through some browser interface because I don't have access to the source code of the web.
Yes. Just how depends on which browser you're using:
For Chrome and Safari you'll use the built-in Web Inspector—see the instructions on this page.
Firefox has the built-in Web Console, but the more advanced add-on Firebug is very popular.
The Internet Explorer equivalent is Developer Tools, which you can launch with F12.
You can use a bookmarklet, the javascript console or a browser plugin to run your own code in an already loaded page.
Greasemonkey is a browser plugin for Firefox that provides a framework for running your own javascript code in other web pages that are already loaded.
You can either simply type it into the JavaScript console for your browser, or for trivial things, you can use the javascript: protocol handler.
One of the first links when searching on google - Get Started With Greasemonkey
How do I enable the debug view like I can in Safari on iOS? I simply need to see if a Xoom that I'm testing a page on is generating javascript errors. I was trying to find how to enable the dev tools in the Android browser like I do for iOS but can't seem to locate it.
I've worked on an Android app in the past where the java developer set it to alert JavaScript errors - caught an extra bug that we didn't catch in the iOS version because of it. So, if you have access to the java layer, I'd check that out. I asked him what he did specifically and he said:
"There's a callback from the WebView class that lets me know when the JS code throws an error. I implemented that callback to display an android dialog."
There's two solutions other ideas on top of this that I use for debugging (ios/android). These are especially useful for embedded web views in games where you don't have access to the built-in console:
1) Weinre a still beta, but functional, remote debugger. It'll give you a faux inspector on your desktop that you can query / see errors on your remote device with. Has a whole dom inspector and anything. The guy that develops it is pretty responsive, too.
2) I write a javascript log function that hits my servers error log. Just tail your log file and you're good to go. My javascript function looks something like this:
function hlog(){
var s = Array.prototype.slice.apply(arguments).join('¶');
document.createElement('img').src = 'http://yourdevbox/debugger/?m=' + encodeURIComponent(s);
}
That way I can take any number of arguments.
My php page that recieves this request looks like this:
# ensure this can't be used in production
if (strpos($GLOBALS['HTTP_HOST'], 'devboxhostname') < 0) die(':(');
error_log($_GET['m']);
Hopefully in the future, mobile devs will have way better debugging tools.
Android doesn't (currently) have a WebInspector like Chrome/Chromium does.
You can still look at any console.log() messages fired under window.console in logcat.
Source: http://developer.android.com/guide/webapps/debugging.html
Also, whilst Firefox 4 is available for Android, Firebug currently isn't supported on the mobile version of the browser.
type about:debug into the url field and validate, a javascript console will then be available (same method to remove it)
a bit more on this page: https://android.stackexchange.com/questions/5999/android-browsers-aboutdebug-what-do-those-settings-do
The best you can do is use console.log() (like firebug), and then install a log viewer on your phone, filter based on browser, and you can see all the console messages. (source)
Try
Weinre: Web Inspector Remote / Watch demo
"Weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone. "
You may have a look some other remote debugging tools: jsconsole or
Aardwolf
Opera mobile has remote debugging:
http://dev.opera.com/articles/view/remote-debugging-with-opera-dragonfly/
The Android default doesn't seem to have a debugger, although you can debug on chrome/chromium on a pc, which uses the same webkit rendering. (There's even a emulate Android option, but it doesn't have all the quirks of Android tablets, image/memory constraints etc.)
Firebug Lite is also a possibility:
http://getfirebug.com/firebuglite
You don't have to install any software or try to debug in your tiny mobile screen.
First enable USB debugging in your device in the "Developer settings" and then use your desktop chrome to connect and debug the mobile browser.
I found the easiest way is to enabled USB debugging on the phone/tablet and in your desktop navigate chrome to
chrome://inspect/#devices
Enable discover usb devices and then on the list of apps click "Inspect"
Voila! Remote debugging! Now you can debug your phone from the comfort of your desktop