I built a PyQt5 GUI to do some Selenium testing. Everything works as expected, except for the PyQt progress bar.
In the first example below, where I use the Selenium browser, the progress bar just jumps to 100%, at the end, when the browser closes. But, the Selenium works as expected.
def test(self):
self.completed = 0
browser = webdriver.Firefox()
links = ['http://www.somesite.com/', 'http://www.somesite.com/page2',
'http://www.somesite.com/page3']
for link in links:
browser.get(link)
self.completed += 100 / len(links)
time.sleep(2)
print(link)
self.progressBar.setValue(self.completed)
browser.close()
But, in this version below, with the Selenium browser commented out, the progress bar works as expected.
def test(self):
self.completed = 0
#browser = webdriver.Firefox()
links = ['http://www.somesite.com/', 'http://www.somesite.com/page2',
'http://www.somesite.com/page3']
for link in links:
#browser.get(link)
self.completed += 100 / len(links)
time.sleep(2)
print(link)
self.progressBar.setValue(self.completed)
#browser.close()