Skip to content

Commit

Permalink
Anchors don't agree with setUrl. Using load instead. Fixes thoughtbot#92
Browse files Browse the repository at this point in the history
  • Loading branch information
halogenandtoast committed Sep 30, 2011
1 parent 89bee3c commit f75bc3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 7 additions & 0 deletions spec/driver_spec.rb
Expand Up @@ -177,6 +177,13 @@
end
end

it "handles anchor tags" do
subject.visit("#test")
subject.find("//*[contains(., 'hello')]").should_not be_empty
subject.visit("#test")
subject.find("//*[contains(., 'hello')]").should_not be_empty
end

it "finds content after loading a URL" do
subject.find("//*[contains(., 'hello')]").should_not be_empty
end
Expand Down
6 changes: 1 addition & 5 deletions src/Visit.cpp
Expand Up @@ -8,11 +8,7 @@ Visit::Visit(WebPage *page, QObject *parent) : Command(page, parent) {

void Visit::start(QStringList &arguments) {
QUrl requestedUrl = QUrl(arguments[0]);
page()->currentFrame()->setUrl(QUrl(requestedUrl));
if(requestedUrl.hasFragment()) {
// workaround for https://bugs.webkit.org/show_bug.cgi?id=32723
page()->currentFrame()->setUrl(QUrl(requestedUrl));
}
page()->currentFrame()->load(QUrl(requestedUrl));
}

void Visit::loadFinished(bool success) {
Expand Down

0 comments on commit f75bc3d

Please sign in to comment.