计算机代写 lec1-vm

lec1-vm

In [10]:

from IPython.core.display import display, Image
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException

options = Options()
options.headless = True
b = webdriver.Chrome(options=options, executable_path=”chromium.chromedriver”)

def show_screen():
b.save_screenshot(“screen.png”)
display(Image(“screen.png”))

b.get(“https://tyler.caraza-harter.com/cs320/tricky/page2.html”)

while True:
show_screen()
try:
btn = b.find_element_by_id(“more”)
except NoSuchElementException:
break
print(“CLICK”)
btn.click()

CLICK

CLICK

CLICK

In [2]:

b.page_source

Out[2]:

‘\n \n \n \n \n

Keep clicking…

\n\n

name formed dissipated mph damage deaths
Baker 08/18/1950 09/01/1950 105 2.55M 38
Camille 08/14/1969 08/22/1969 175 1.42B 259
Eloise 09/13/1975 09/24/1975 125 560M 80
Frederic 08/29/1979 09/15/1979 130 1.77B 12
Elena 08/28/1985 09/04/1985 125 1.3B 9
Opal 09/27/1995 10/06/1995 150 4.7B 63
Danny 07/16/1997 07/27/1997 80 100M 4
Ivan 09/02/2004 09/25/2004 165 26.1B 92
Dennis 07/04/2005 07/18/2005 150 3.98B 76
Katrina 08/23/2005 08/31/2005 175 125B 1245
Carol 08/25/1954 09/01/1954 115 462M 72
Donna 08/29/1960 09/14/1960 145 980M 439
Gloria 09/16/1985 10/02/1985 145 900M 14
Bob 08/16/1991 08/29/1991 115 1.5B 15
Labor Day 08/29/1935 09/10/1935 185 100M 423
Easy 09/01/1950 09/09/1950 125 3.3M 2
King 10/13/1950 10/20/1950 130 32M 11
FLORENCE 09/23/1953 09/26/1953 115 200K 0
Flossy 09/21/1956 09/30/1956 90 24.9M 15
Cleo 08/21/1964 09/05/1964 155 187M 156
Dora 08/28/1964 09/14/1964 130 280M 5
Isbell 10/08/1964 10/19/1964 125 30M 7
Betsy 08/27/1965 09/13/1965 155 1.43B 81
Alma 06/04/1966 06/14/1966 125 210.1M 93
Inez 09/21/1966 10/11/1966 150 226.5M 756
Gladys 10/13/1968 10/21/1968 85 18.7M 8
Agnes 06/14/1972 07/06/1972 85 2.1B 128
Kate 11/15/1985 11/23/1985 120 700M 15
Floyd 10/09/1987 10/13/1987 75 500K 1
Andrew 08/16/1992 08/29/1992 175 27.3B 65
Erin 07/31/1995 08/06/1995 100 700M 6
Earl 08/31/1998 09/08/1998 100 79M 3

\n\n \n \n\n‘