My script is trying to access this login page:
http://instagram.com/accounts/login
using PhantomJS, Watir.
The problem with the login page is that the text input fields are in the iFrame:
<iframe class="hiFrame" data-reactid=".0.0.0.1.0.1.0.0.$frame" src="https://instagram.com/accounts/login/ajax/?targetOrigin=https%3A%2F%2Finstagram.com" scrolling="no" seamless="">
#document
<!DOCTYPE html>
<html class="hl-en not-logged-in " lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body class="LoginFormChrome ">
<div class="LoginFormPage" data-reactid=".0">
<form data-reactid=".0.0">
<p class="lfField" data-reactid=".0.0.0">
<label class="lfFieldLabel" data-reactid=".0.0.0.0"></label>
<input class="lfFieldInput" type="text" data-reactid=".0.0.0.1" value="" autocorrect="false" autocapitalize="false" maxlength="30" name="username"></input>
</p>
<p class="lfField" data-reactid=".0.0.1"></p>
<p class="lfActions" data-reactid=".0.0.2"></p>
</form>
</div>
<div id="fb-root" class=" fb_reset"></div>
</body>
</html>
</iframe>
Here is my code (Ruby):
B.goto HOME_URL + LOGIN
sleep(5)
puts B.iframe(:class => "hiFrame").text_field(:name => "username").exists?
B.iframe(:class => "hiFrame").text_field(:name => "username").set USERNAME
B.iframe(:class => "hiFrame").text_field(:name => "password").set PW
B.iframe(:class => "hiFrame").button.click
Works fine using the Firefox browser, but when I switch to Phantomjs it doesn't recognize
B.iframe(:class => "hiFrame").text_field(:name => "username").exists?
and stops the script. Returns true for:
B.iframe(:class => "hiFrame").exists?
But what degree is it. How can I login using phantomjs and watir?
Thank.
source
share