Comments (12)
This isn't possible at the moment but should be possible with the next version of PhantomJS.
from poltergeist.
Cool. I dig what you're doing with this project. Will happily give it another go in the future.
from poltergeist.
FWIW you could probably get around it by putting a Rack middleware around you app to set the header.
from poltergeist.
Unfortunately, headers aren't the only problem, it's just the problem I felt confident reporting an issue about. Currently, I can swap out capybara-webkit with selenium and all the tests pass. This is not the case with poltergeist, and I don't have the time to dig in further to find the actual problem. I've lazily resolved to give the project another shot sometime in the future.
from poltergeist.
If capybara-webkit solves your problems at the moment then I wouldn't suggest switching :)
Without more info it's hard to guess what might be the issue, but one key difference to c-w (and I think selenium) is that in poltergeist a click only works if the element is not obscured by another element (like in a real browser). I've added some code to master to detect whether a click will fail so if you're curious then give master a go.
from poltergeist.
I've looking at the code and i cannot set userAgent, not sure why.
Phantom now provides a: page.settings.userAgent = 'Something'
which works, i've been looking at lib/capybara/poltergeist/client/web_page.coffee
and for some reason
@native.settings.userAgent = "Something"
does not work.
Perhaps i'm missing something
from poltergeist.
@elcuervo sorry, I don't have any insight into your problem (though I haven't tried it myself)
FWIW PhantomJS now supports setting headers: https://code.google.com/p/phantomjs/issues/detail?id=452
But the code is in master - it's not supported in 1.5.0, so we'll need to wait for 1.6.0 to add this to Poltergeist.
from poltergeist.
Specifically i'm referring about doing something like this which works in 1.5.0: http://cl.ly/1q1j1Z1Z2S3Y22322V3a/Screen%20Shot%202012-05-04%20at%202.36.19%20PM.png
from poltergeist.
@elcuervo The .coffee files are compiled to .js in the client/compiled/ directory. I was able to override the user agent by adding:
this["native"].settings.userAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3";
in between lines 9 and 10 (https://github.com/jonleighton/poltergeist/blob/v0.6.0/lib/capybara/poltergeist/client/compiled/web_page.js#L9)
/cc @jonleighton
from poltergeist.
Curious hack. Worked like a charm though. Kudos, defeated.
from poltergeist.
In terms of setting the user agent see this: https://github.com/carhartl/poltergeist/tree/user_agent
from poltergeist.
Closing this as header support was added and there is a separate bug for the user agent issue.
from poltergeist.
Related Issues (20)
- React event not triggered [help] HOT 2
- Capybara::Poltergeist::TimeoutError in some environments HOT 23
- ReferenceError: Can't find variable: Audio HOT 1
- React components not loading HOT 1
- Following jQuery line of code does not work in anything above v1.8.1 HOT 8
- Typo in keys method HOT 1
- Version of JS supported HOT 1
- Broken rails UJS loading when use arrow functions HOT 1
- Timeout occurs causing all following javascript tests to fail. HOT 3
- Capybara::Poltergeist::StatusFailError on 302 redirects with port numbers HOT 2
- Future of Poltergeist HOT 14
- Screenshot is not created HOT 1
- Authz request header missing HOT 5
- User agent does not persist across windows HOT 3
- Capybara::Poltergeist::TimeoutError when running CI tests HOT 7
- current_url returns empty string on about:blank HOT 3
- page.current_path always root HOT 2
- Possible make a method that check if JS Alert exist
- TypeError When dealing with link clicks via Capybara::Session HOT 2
- Capybara::Poltergeist::StatusFailError: failed to reach server (but manually I can connect perfectly) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from poltergeist.