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_())
点击启动浏览器,浏览器是启动了,然后还没访问百度,程序就自动闪退了,浏览器也不访问百度了,有没有大佬给看下 |