From 28330607a34e653992f5d05887ab526eb317a259 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20S=C3=A1=20Couto?= Date: Sat, 16 Mar 2019 16:34:14 +0100 Subject: [PATCH] still not saving bios but printing them, saves images --- .DS_Store | Bin 0 -> 6148 bytes geckodriver.log | 1268 +++++++++++++++++++++++++++++++++++++++++ selenium_instances.py | 71 ++- 3 files changed, 1332 insertions(+), 7 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..55814f5096b600f6465ece8238e149332d951a9e GIT binary patch literal 6148 zcmeHKu};G<5PerFRMdek2o|J_EK~(XmZ&NNGamr7jVeS)P-#)wvhWZ50^i36z&qQj znlzPIKnUGQ=Vv?jF7~q(#{i^1AD;jn04=&=V~0hJ>2vipYlNO{qPQG6#+c#`&q&sy zt>Z5$pljF0gzGiJJyzFmdYR^#HQ=zGg=4OM4_%z%jAf7Q2i!7y zjwiNftXDG2ekJqnhRj`#a)G2gE_wYnJLMQA74}Dk-RAyHIMO*%j@6HNfmxY_bF$u6 zwAf>0LPmm&yMN9ZUlTL->U=ZKUUPQwh?km7tEw`wnJHijm;yhp0MBf-R@`S??Xgai~|-P-KT?vy8;lK>~_Yw{wyjd3K$10Jn{)mJeBCF60R8H>Fkd}TpY0Q z=;@Gf`H=8t2{#mRZ)g6*WnTn+l1 zQaD@JCZ}g@M8Bb{X img:nth-child(1)') + src = img.get_attribute('src') + # download the image + Picture_request = requests.get(src) + if Picture_request.status_code == 200: + with open("image%i.jpg"%i, 'wb') as f: + f.write(Picture_request.content) + + except: + #back to original tab + driver.switch_to.window(driver.window_handles[0]) + + time.sleep(1) + + # # NOT WORKING + # # close new tab + # driver.find_element_by_xpath('/html/body').send_keys(Keys.COMMAND + 'w') + # print("Closing Window") + + #back to original tab + driver.switch_to.window(driver.window_handles[0]) + # closes pop up driver.find_element_by_css_selector('.btn.btn-secondary').click() - time.sleep(0.5) - - # scroll to just under the video in order to load the comments - driver.execute_script('window.scrollTo(1, 40);') - time.sleep(0.5) + time.sleep(1) d+=1 + i+=1 + text_file.write(str(results)) +#pprint(results) +#text_file.write(str(results)) +text_file.close() # close the browser driver.close()