entfernen von 1000er Trennzeichen und " Franken"

This commit is contained in:
romanschenk37 2022-03-11 23:46:36 +01:00
parent 1a0e75fe3c
commit aaad6a5b07
1 changed files with 16 additions and 16 deletions

32
Main.py
View File

@ -56,12 +56,11 @@ def search_adresses(adress_list, filename_adresslist, driver):
if(suggestion.text == search_string): if(suggestion.text == search_string):
found = True found = True
suggestion.click() suggestion.click()
driver.implicitly_wait(120) driver.implicitly_wait(10)
break break
if(found): if(found):
# TODO: Validation
time.sleep(2)
url = driver.current_url url = driver.current_url
eignung = driver.find_element(By.ID, "eignung") eignung = driver.find_element(By.ID, "eignung")
pv_Production50 = driver.find_element(By.ID, "pv50") pv_Production50 = driver.find_element(By.ID, "pv50")
@ -75,10 +74,10 @@ def search_adresses(adress_list, filename_adresslist, driver):
adress[columnIndexes[5]] = eignung.text adress[columnIndexes[5]] = eignung.text
adress[columnIndexes[6]] = image_filename adress[columnIndexes[6]] = image_filename
# TODO: 1000er Trennzeichen und " Franken" entfernen # TODO: 1000er Trennzeichen und " Franken" entfernen
adress[columnIndexes[7]] = pv_Production50.text adress[columnIndexes[7]] = pv_Production50.text.replace("'", "")
adress[columnIndexes[8]] = pv_Production75.text adress[columnIndexes[8]] = pv_Production75.text.replace("'", "")
adress[columnIndexes[9]] = pv_Production100.text adress[columnIndexes[9]] = pv_Production100.text.replace("'", "")
adress[columnIndexes[10]] = value_electricity_production.text adress[columnIndexes[10]] = value_electricity_production.text.replace("'", "").replace(" Franken", "")
@ -94,25 +93,26 @@ def search_adresses(adress_list, filename_adresslist, driver):
adress_file.write(new_adress_list) adress_file.write(new_adress_list)
adress_file.close() adress_file.close()
# Create QR-Code
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(url)
qr.make(fit=True)
qr.make_image(fill='black', back_color='white').save("qrcodes/" + image_filename)
#Create Screenshot #Create Screenshot
featureElement = driver.find_element(By.XPATH, "//section[@id='one']//div[@class='container']//div[@class='row 150%']") featureElement = driver.find_element(By.XPATH, "//section[@id='one']//div[@class='container']//div[@class='row 150%']")
location = featureElement.location location = featureElement.location
size = featureElement.size size = featureElement.size
driver.save_screenshot("screenshots/" + image_filename)
x = location["x"] x = location["x"]
y = 0 # location["y"] y = 0 # location["y"]
w = x + size["width"] w = x + size["width"]
h = y + size["height"] - 100 h = y + size["height"] - 100
area = (x, y, w, h) area = (x, y, w, h)
fullImg = Image.open("screenshots/" + image_filename) time.sleep(2)
cropImg = fullImg.crop(area) driver.save_screenshot("screenshots/" + image_filename)
cropImg.save("screenshots/" + image_filename) time.sleep(0.2)
Image.open("screenshots/" + image_filename).crop(area).save("screenshots/" + image_filename)
#Create QR-Code
qr = qrcode.QRCode(version=1, box_size=10, border=5)
qr.add_data(url)
qr.make(fit=True)
qr.make_image(fill='black', back_color='white').save("qrcodes/" + image_filename)
print(image_filename + " was saved.") print(image_filename + " was saved.")