Ejemplo n.º 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)]
Ejemplo n.º 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)]
Ejemplo n.º 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)]
Ejemplo n.º 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)
        ]
Ejemplo n.º 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)
        ]
Ejemplo n.º 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)]
Ejemplo n.º 7
0
 def action_visit(self, target, param):
     yield js.addLoadObserver(self.checkException()), livepage.eol
     yield js.setContentLocation(target), livepage.eol
Ejemplo n.º 8
0
 def action_visit(self, target, param):
     yield js.addLoadObserver(self.checkException()), livepage.eol
     yield js.setContentLocation(target), livepage.eol