Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HtmlUnit Type Error: Cannot find function #48

Open
maca opened this issue Jan 27, 2011 · 12 comments
Open

HtmlUnit Type Error: Cannot find function #48

maca opened this issue Jan 27, 2011 · 12 comments

Comments

@maca
Copy link

maca commented Jan 27, 2011

Hi, I am trying to test Facebook connect integration with my app, I can login to facebook, and executing some javascript unauthorize my app for testing authorization. Shit happens when through akephalos I visit facebook authorizatation page and I press Allow, then I get this message:

       com.gargoylesoftware.htmlunit.ScriptException: TypeError: Cannot find function parse in object [object Window]. (script in http://www.facebook.com/connect/uiserver.php?method=permissions.request&app_id=143526625701274&display=page&redirect_uri=http%3A%2F%2Fboston-test.com%2Fauthentication%2Ffacebook&type=web_server&fbconnect=1&perms=email%2Cpublish_stream&from_login=1 

here's a gist on how the error can be reproduced:

https://gist.github.com/799148

I googled about this and some posts suggest changing html unit browser emulation to IE7,

does akephalos provides an option for doing so?

@Nerian
Copy link
Contributor

Nerian commented Jan 29, 2011

Can you try using this repo please:

gem 'akephalos', :git => "git@github.com:Nerian/akephalos.git"

@maca
Copy link
Author

maca commented Feb 2, 2011

Nerian, thanks. I've tried using your repo but when using it to running my features it won't rely on the akephalos driver but the rack test one. Meaning webrick is not launched and any visit that involves going out of my app won't work.

@Nerian
Copy link
Contributor

Nerian commented Feb 2, 2011

Do you have this? Capybara.default_driver = :akephalos

@maca
Copy link
Author

maca commented Feb 2, 2011

Yeah, I do, I could run my features with akephalos prior to adding your repo to my Gemfile.

@maca
Copy link
Author

maca commented Feb 2, 2011

BTW, I am not using Rails but Sinatra.

@Nerian
Copy link
Contributor

Nerian commented Feb 2, 2011

I tried something. Tell if it works: https://github.com/Nerian/akephalos/tree/emulation-ie7

gem 'akephalos', :git => "git://github.com/Nerian/akephalos.git", :branch=>"emulation-ie7"

@Nerian
Copy link
Contributor

Nerian commented Feb 2, 2011

Mmm nah, it fails. Let me rethink.

@Nerian
Copy link
Contributor

Nerian commented Feb 2, 2011

Ok, I did set html unit browser emulation to IE7. Check if your test works now.

gem 'akephalos', :git => "git://github.com/Nerian/akephalos.git", :branch=>"emulation-ie7"

@maca
Copy link
Author

maca commented Feb 2, 2011

Still no luck, I guess web server is getting launched because it takes longer to start but I get no feedback, I don't know if starts on the same port. I have edited my hosts file to have a dummy domain pointing to localhost and I setted an Nginx virtual host as a proxy for that domain into the port 9887 which is the one used by akephalos, all this because to test Facebook integration I need to provide a domain.
Anyway when I try to see what akephalos is getting I get a bad gateway which makes me believe akephalos is not launching a web server or it is launching it in another port.

@maca
Copy link
Author

maca commented Feb 2, 2011

Setting client.setThrowExceptionOnScriptError(false) as here solved the issue.

https://github.com/windock/akephalos/commit/bb56c7575a515f8b878c7513b608788b23c7ee58

@Nerian
Copy link
Contributor

Nerian commented Feb 2, 2011

That's weird, that code it is actually in my that too.

@ashes999
Copy link

ashes999 commented Nov 6, 2013

(3 years later)

This solved my problem too. My "missing" function was document.getElementsByClassName, which doesn't make much sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants