A
A
ArtemBlueberry2016-05-06 20:41:48
selenium
ArtemBlueberry, 2016-05-06 20:41:48

How to open instagram with phantomjs?

Can't open instagram homepage with phantomjs (tried 2.1, 1.9)

var page = require('webpage').create();
page.viewportSize = { width:1024 , height: 768 };
page.settings.userAgent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.71 Safari/537.36';

 url = 'https://www.instagram.com/';

page.open( url, function() {
  setTimeout(function() {
    console.log('before render');
    page.render('insta.png');
    phantom.exit();
  }, 5000);

});

- here the insta.png file is empty
or using selenium:
driver = Selenium::WebDriver.for :phantomjs
driver.get 'https://www.instagram.com/'

wait = Selenium::WebDriver::Wait.new(:timeout => 500)
wait.until { driver.find_elements(name: 'password').length != 0 }
puts  'page loaded'

- in this case, everything gets stuck on wait.until
I thought the problem was in react. But the pages of facebook or another site written using react normally open

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
ArtemBlueberry, 2016-05-16
@ArtemBlueberry

the solution was to add the keys --ignore-ssl-errors=true --ssl-protocol=any

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question