CS代写 lec2-vm – cscodehelp代写

lec2-vm

In [11]:

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

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

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

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

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

CLICK!

CLICK!

CLICK!

In [12]:

import selenium
selenium.__version__

Out[12]:

‘3.141.0’

Leave a Reply

Your email address will not be published. Required fields are marked *