I am currently working on a GUI with PyQt5 and attempting to connect it with my selenium web-driver script. I have connected the button to run the script but the problem is script goes into a shopping website and checks out Items for you sizes.I have put in variables inside the script and text boxes inside the GUI.I want to be able to type In the size into the QLineEdit and have the script choose it here is an example of my script.
self.Start_Button_2 = QtWidgets.QPushButton(self.Window_2)
self.Start_Button_2.setGeometry(QtCore.QRect(100, 370, 221, 51))
self.Start_Button_2.setAutoFillBackground(False)
self.Start_Button_2.setObjectName("Start_Button_2")
self.Start_Button_2.clicked.connect(self.BOT)
and then I define the bot below:
def BOT(self):
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.select import Select
from selenium.common.exceptions import NoSuchElementException
import time
driver = webdriver.Chrome(executable_path='/Users
URL = .....
driver.get(URL)
select = Select(driver.find_element_by_id('s'))
#select.select_by_visible_text(Size)
I have text boxes for size that the user puts in and
self.Item_Code_2 = QtWidgets.QLineEdit(self.Window_2)
self.Item_Code_2.setGeometry(QtCore.QRect(20, 40, 125, 21))
self.Item_Code_2.setObjectName("Item_Code_2")
self.Name_2 = QtWidgets.QLineEdit(self.Window_2)
I tried size = self.Item_Code_2.text but it is not working. Help me how to connect a text box into a function script?