Attempt to visit URLs with invalid characters

* Fixes issues with URLs which include square brackets
This commit is contained in:
Kirill Nikitin 2013-11-09 16:41:55 -05:00 committed by Joe Ferris
parent 0cffabde39
commit 525a8bb130
2 changed files with 7 additions and 1 deletions

View File

@ -424,6 +424,12 @@ describe Capybara::Webkit::Driver do
driver.current_url.should =~ /success=\%25true/ driver.current_url.should =~ /success=\%25true/
end end
it "returns the current URL with encoded characters" do
visit("/hello/world?success[value]=true")
current_url = Rack::Utils.unescape(driver.current_url)
current_url.should include('success[value]=true')
end
it "visits a page with an anchor" do it "visits a page with an anchor" do
visit("/hello#display_none") visit("/hello#display_none")
driver.current_url.should =~ /hello#display_none/ driver.current_url.should =~ /hello#display_none/

View File

@ -7,7 +7,7 @@ Visit::Visit(WebPageManager *manager, QStringList &arguments, QObject *parent) :
} }
void Visit::start() { void Visit::start() {
QUrl requestedUrl = QUrl::fromEncoded(arguments()[0].toUtf8(), QUrl::StrictMode); QUrl requestedUrl = QUrl::fromEncoded(arguments()[0].toUtf8(), QUrl::TolerantMode);
page()->currentFrame()->load(QUrl(requestedUrl)); page()->currentFrame()->load(QUrl(requestedUrl));
finish(true); finish(true);
} }