I have a series of automated tests in Ruby that use Capybara, Poltergeist, and PhantomJS to interact with web pages. However, the problem is that some pages are not working properly because jQuery does not seem to load. For example, on one web page there is such code as:
<script type="text/javascript">
</script>
But this does not work / works. From what I read, it seems that PhantomJS doesn't work fine with jQuery (or at least it doesn't load jQuery automatically). How can I fix this. Keep in mind that I cannot change the actual code of the webpage.
Summary. How can I add / insert / load jQuery when using PhantomJS, Poltergeist and Capybara?
EDIT: This is how I use phantomjs. Please note that I never use phantomjs directly. The phantomjs executable file is indirectly used by the Poltergeist:
Capybara.register_driver :poltergeist do |app|
driver = Capybara::Poltergeist::Driver.new(app,
:debug => debug,
:window_size => [1616, 1000],
:js_errors => true,
:cookies => true,
:phantomjs_options => ['--ignore-ssl-errors=true',
'--web-security=false',
'--local-to-remote-url-access=true',
'--proxy-type=none' ],:timeout => 180
)
source
share