0

I have the following that opens an initial url. Once opened javascript is evaluated and a button is clicked resulting in the browser redirecting to a new url. I would like to execute self.web.loadFinished.connect(t) each time the browser is redirected

def q(self, meth, url):
    t=meth
    url=url
    app=QApplication(sys.argv)
    self.web=QWebView()
    self.phantom()
    self.setProxy()
    self.web.load(QUrl(url))
    self.web.loadFinished.connect(t)
    self.web.urlChanged.connect(t)
    self.web.show()
    app.exec_()

The problem I have is that I received the loadFinished and urlChanged signal only for the inital url page load and not any subsequent redirects.

def t():
   create=self.n.web.findText("ACCOUNT")
   account=self.n.web.findText("One account.")
   fill=self.n.web.findText("Create Account")
   setup=self.n.web.findText("Success")
   if(account):
       self.n.JS("document.getElementById('signup').click();",False)
   elif(create):
       self.n.JS("document.getElementsByClassName('sign-in')[0].click();",False)
    elif(fill):
       self.setName()
       self.setUserName()
       self.setPassword()

Please help.

the_big_blackbox
  • 1,056
  • 2
  • 15
  • 35

0 Answers0