示例#1
0
    def action_follow(self, target, param):
        if isinstance(target, xpath):
            yield target._asjs(js.targetNode)
        else:
            yield livepage.var(js.targetNode, gid(target)), livepage.eol

        yield [
            js.addLoadObserver(self.checkException()),
            livepage.eol,
            js.setContentLocation(js.targetNode.href)]
示例#2
0
    def action_follow(self, target, param):
        if isinstance(target, xpath):
            yield target._asjs(js.targetNode)
        else:
            yield livepage.var(js.targetNode, gid(target)), livepage.eol

        yield [
            js.addLoadObserver(self.checkException()),
            livepage.eol,
            js.setContentLocation(js.targetNode.href)]
示例#3
0
 def action_visit(self, action, target, parameter):
     def observeLoading(client, location):
         if location.endswith(target):
             self.passed()
         else:
             self.failed()
     return ["addLoadObserver(function() {", 
             livepage.handler(
                 observeLoading,
                 contentDocument.location),
             "});",
             js.setContentLocation(target)]
示例#4
0
    def action_visit(self, action, target, parameter):
        ## TODO: Figure out how to detect a 404 using javascript
        def observeLoading(client, location):
            if location.endswith(target):
                self.passed()
            else:
                self.failed()

        return [
            "addLoadObserver(function() {",
            livepage.handler(observeLoading, contentDocument.location), "});",
            js.setContentLocation(target)
        ]
示例#5
0
    def action_follow(self, action, target, parameter):
        def observeFollowing(client, location, destination):
            if location.endswith(destination):
                self.passed()
            else:
                self.failed()

        return [
            "var theTargetNode = ",
            contentDocument.getElementById(target), ";",
            "var theDestinationAddress = theTargetNode.href;",
            "addLoadObserver(function() {",
            livepage.handler(observeFollowing, contentDocument.location,
                             js.theDestinationAddress), "});",
            js.setContentLocation(js.theDestinationAddress)
        ]
示例#6
0
 def action_follow(self, action, target, parameter):
     def observeFollowing(client, location, destination):
         if location.endswith(destination):
             self.passed()
         else:
             self.failed()
     return [
         "var theTargetNode = ",
         contentDocument.getElementById(target), ";",
         "var theDestinationAddress = theTargetNode.href;",
         "addLoadObserver(function() {",
         livepage.handler(
             observeFollowing,
             contentDocument.location,
             js.theDestinationAddress),
         "});",
         js.setContentLocation(js.theDestinationAddress)]
示例#7
0
 def action_visit(self, target, param):
     yield js.addLoadObserver(self.checkException()), livepage.eol
     yield js.setContentLocation(target), livepage.eol
示例#8
0
 def action_visit(self, target, param):
     yield js.addLoadObserver(self.checkException()), livepage.eol
     yield js.setContentLocation(target), livepage.eol