lundi 18 juin 2018

python selenium find element by xcode

import selenium.webdriver as webdriver
print("This program finds the imdb rating of a movie or TV series!!!")
def get_results(search_term):
    url="https://www.google.com"
    browser=webdriver.Safari()
    browser.get(url)
    search_box= browser.find_element_by_id("lst-ib")
    search_box.send_keys(search_term)
    search_box.submit()
    href=""
    links=browser.get_element_by_class("//slp f//a")
    print(links)

    browser.close()

search_key=input("Enter the movie name : ")
get_results("what is the imdb rating of "+search_key)

how can i print a specific line from a webpage to the terminal can i use find_element_by_xcode() or get_element_by_class()




Aucun commentaire:

Enregistrer un commentaire