How to make phantomjs remember a login session? - javascript

I am using PhantomJS to test a website. However, when you login to this website, you have to enter a CAPTCHA string. I try to render the page, then enter the CAPTCHA from console and pass it to the CAPTCHA field, but the page reloads again and my string does not match the CAPTCHA anymore. I guess it's a session problem.
So I want to know if there is any way that I can login to this page on a browser (Firefox or Chrome...) and do something so that when my PhantomJS program opens that page, it will lead to the main page, not the login page. Or is there any better solution?

Related

How does chrome know that my login was sucessfull?

If I login on any new site, google chrome asks me if I want it to save my password.
My initial thought was that it simply watches form submits, but the prompt doesn't show when the login fails because of a wrong password.
So how does it know? Is it looking for URL changes or something more complex?
(Context: I'm working on a chrome extension that alerts you whenever you enter a weak password. Simply adding an 'onsubmit' event handler to the login form doesn't work for me, because some of the checks run asynchronously. I also tried using event.preventDefault() and asynchronously calling the form submit again later, but that doesn't seem to work for some sites.)
My guess is that it watches for URL changes after submit. I noticed with some slow-loading websites that the password save dialog is shown only after the subsequent page begins to load. On the other hand, the dialog is not displayed when the same login page is simply reloaded (with or without additional args) which usually happens on bad login.
But this is an educated guess only.

Reload web page in GWT

After a user logged and press my page url in this page if user press confirm button i want to relaod my page not the home page
Window.alert(ConstantesMessage.MESSAGE_MSG004);
eventBus.goToMyPage();
Window.Location.reload();
this solution work but it's reload the home page not my page
A GWT application is a single page application. So if you reload the web page you get your start page, unless you use the history tokens. See http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsHistory.html When you have a history token the page is still reloaded, but based on the history token you can open the page you want to show. I guess you don't have the history token set, so you'll get your home page.
As an extra thought. It looks like you built the login in GWT. A better solution is to provide a separate login page. And when the user is successfully logged in then open the application.

How can I prevent saving/downloading web page?

I was wondering if there was a way to prevent a user from saving/downloading a web page? Specifically, I mean not letting them have access to the data displayed through my web application on their own machine?
I've heard that this is not possible since the browser must have access to the source code/data, but at the same time, I've noticed that if I to my gmail account, open an email, save the page, but when I try to open that page on my computer, it doesn't work. Furthermore, if I click "view source", I can see that even the source does not display the entire email message, even though the email is opened in my browser.
How it's possible for gmail to prevent me from seeing that email data?
Thats what called rendering pages using dynamic data without refreshing page (AJAX). The entire page source code is not downloaded in one go and components within the page request data asynchronously to display content. Try googling it and you will find more information.
In View source you can only see the HTML, CSS, JavaScript codes. No one can copy any dynamic code (PHP) from view source.
You can't stop anyone to see your html,css code in browser, as we are having view source option.
Maximum what you can do is disable right click on your page. Thant can be done through JavaScript.

Javascript redirect before the rest of the page is loaded?

I am making an iPhone webapp with a login form. Once the user is logged in I am storing some information in an HTML5 DB.
The problem is that every time the app is loaded the login.php page runs and checks if there is some info in the DB, if there is, it redirects to data.php, but in the meantime I see a short buy annoying flash of login.php.
I am placing the code that checks the DB on top of the page with a window.stop() after it, but no luck.
Any point in the right direction will be much appreciated!
thanks!
Do the checking in login.php (and handle the redirect) before you display anything, not after displaying the page.

Creating an auto-login script to website?

We have an intra-net website that requires me to enter login information every time and it's annoying.
I want to create some sort of automatic login for this website.
I tried creating a two-frame website, with one page being the login page and the other being my own html. In my html, I wanted to enter values to the textboxes in the other frame but got an "access denied" js error.
Any other idea?
(I know I can record a Macro, but unfortunately, can't install any third-party applications in the inner-network. I could also have used Robo-Form...).
Oh yeah, and it has to work on the worst browser ever, Internet Explorer 6...
Maybe local html file with form that mimic login form and with autosubmit (like onload="form1.submit();"?). Than you can run this file and it will autosubmitted and redirects you where you want to go (form's action).
A greasemonkey script might work.

Categories

Resources