我想用pyqt5简单的启动谷歌浏览器访问百度,但程序会闪退
#coding=gbkimport time
from PyQt5.QtCore import QThread
from PyQt5.QtWidgets import QWidget,QApplication,QPushButton
import sys
from selenium import webdriver
from threading import Thread
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setGeometry(300,300,500,300)
self.setWindowTitle('报关')
self.bt1 = QPushButton('启动浏览器',self)
self.bt1.move(350,20)
self.bt1.clicked.connect(self.openbrower)
self.show()
def openbrower(self):
self.driver = webdriver.Chrome()
self.driver.get('www.baidu.com')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
点击启动浏览器,浏览器是启动了,然后还没访问百度,程序就自动闪退了,浏览器也不访问百度了,有没有大佬给看下 #coding=gbk
import time
from PyQt5.QtCore import QThread
from PyQt5.QtWidgets import QWidget,QApplication,QPushButton
import sys
from selenium import webdriver
from threading import Thread
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def initUI(self):
self.setGeometry(300,300,500,300)
self.setWindowTitle('报关')
self.bt1 = QPushButton('启动浏览器',self)
self.bt1.move(350,20)
self.bt1.clicked.connect(self.openbrower)
self.show()
def openbrower(self):
self.driver = webdriver.Chrome()
self.driver.get('www.baidu.com')
if __name__ == '__main__':
app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_()) 老马森生 发表于 2022-7-15 08:40
#coding=gbk
import time
重新发一遍代码 排错时打个断点看,运行到哪一步导致闪退,然后排查问题 你有没有安装谷歌浏览器驱动呀 JavaUser404 发表于 2022-7-22 21:41
你有没有安装谷歌浏览器驱动呀
问题解决,网址的问题。。{:1_896:}
页:
[1]