try:
element = None
if by == "id":
element = self.driver.find_element_by_id(value)
elif by == "name":
element = self.driver.find_element_by_name(value)
elif by == "css":
element = self.driver.find_element_by_css(value)
elif by == "class":
element = self.driver.find_element_by_class(value)
elif by == "xpath":
element = self.driver.find_element_by_xpath(value)
except:
print("定位by和value有问题")
return element
#运行代码
request_driver = SeleniumDriver()
request_driver.get_url("https://www.imooc.com/user/newlogin")
request_driver.get_element("name","email")