From 42f223f8433b8d87dd892d8edcba9b25b187cc79 Mon Sep 17 00:00:00 2001 From: Llloooggg Date: Thu, 23 Apr 2020 00:11:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=83=D0=BC=D0=BD=D1=8B=D0=B9=20=D0=B1=D1=83?= =?UTF-8?q?=D0=BB=D1=8C=D0=B4=D0=BE=D0=B7=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/__init__.py b/__init__.py index 1c07daf..2f70712 100755 --- a/__init__.py +++ b/__init__.py @@ -38,6 +38,7 @@ if path.exists('./weights_list.txt'): if question[-1:] == ' ': question = question[:-1] weights = line.split(':')[1].split() + weights = [float(num) for num in weights] weightsList[question] = weights f.close() @@ -261,9 +262,8 @@ def another_profile_maker(): coin = random.randint(1, 2) - for i in range(coin): - button = random.choices( - buttons_list, [0.4, 0.3, 0.1, 0.1, 0.1], k=1)[0] + button = random.choices( + buttons_list, [0.4, 0.3, 0.1, 0.1, 0.1], k=coin)[0] button.click() elif header == 'Укажите ваш возраст': @@ -304,7 +304,7 @@ def another_profile_maker(): def smart_buildozer(): - global driver + global driver, weightsList forms_list = driver.find_elements_by_class_name( 'freebirdFormviewerViewItemsItemItem') # получение форм со страницы @@ -390,7 +390,12 @@ def another_main(): driver.get(url) - button_by_text('Далее') + while True: + if button_by_text('Далее'): + smart_buildozer() + else: + break + another_profile_maker() button_by_text('Отправить') @@ -399,7 +404,4 @@ def another_main(): if __name__ == '__main__': - try: - another_main() - except: - driver.close() + another_main()