From f6544fa45d5f9077275495d8a3ae67b7c5cfa427 Mon Sep 17 00:00:00 2001 From: Llloooggg Date: Wed, 22 Apr 2020 17:27:14 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BD=D0=B0=20=D0=B2=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20=D0=B2=20=D0=B4?= =?UTF-8?q?=D0=BE=D0=BB=D0=B6=D0=BD=D0=BE=D1=81=D1=82=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) mode change 100644 => 100755 __init__.py diff --git a/__init__.py b/__init__.py old mode 100644 new mode 100755 index 6c9afe4..2df1562 --- a/__init__.py +++ b/__init__.py @@ -1,3 +1,5 @@ +#!venv/bin/python3 + from selenium import webdriver import time import requests @@ -41,8 +43,8 @@ if path.exists('./weights_list.txt'): def log(header, data=None): - with open(logPath,'a') as f: - f.write(datetime.now().strftime('[%X] ') + header +'\n') + with open(logPath, 'a') as f: + f.write(datetime.now().strftime('[%X] ') + header + '\n') if data: for key, value in data.items(): f.write(f' {key}: {value}\n') @@ -187,7 +189,16 @@ def profile_maker(): elif header == 'Укажите Ваш стаж работы в текущей должности (полных лет)': buttons_list = form.find_elements_by_class_name( 'docssharedWizToggleLabeledContainer') # получение кнопок-радио с формы - coin = random.randint(0, len(buttons_list) - 1) + + if profile['Стаж работы'] == 'Меньше 1 года': + max_variant = 0 + elif profile['Стаж работы'] == 'От 1 года до 3 лет': + max_variant = 1 + elif profile['Стаж работы'] == 'от 3 до 5 лет': + max_variant = 2 + else: + max_variant = 3 + coin = random.randint(0, max_variant) buttons_list[coin].click() profile['Стаж в текущей должности'] = buttons_list[coin].text @@ -275,4 +286,4 @@ if __name__ == '__main__': driver.close() ''' - main() \ No newline at end of file + main()