Python 属性错误:';非类型';对象没有属性';通过xpath查找元素;

Python 属性错误:';非类型';对象没有属性';通过xpath查找元素;,python,Python,我刚刚开始学习硒。我想测试我的代码,我得到了这个错误。如果你帮助我,我会很高兴的` from selenium import webdriver class Book: def __init__(self, site, book_name): self.browser = webdriver.Chrome() self.site = site self.book_name = book_name def google_sear

我刚刚开始学习硒。我想测试我的代码,我得到了这个错误。如果你帮助我,我会很高兴的`

from selenium import webdriver

class Book:
    def __init__(self, site, book_name):
        self.browser = webdriver.Chrome()
        self.site = site
        self.book_name = book_name


    def google_search(self):
        url = "https://www.google.com"
        result = self.browser.get(url)
        SearchInput = result.find_element_by_xpath('//*[@id="input"]').send_keys(self.site +" "+ self.book_name).click()
        return SearchInput

    def bkm_kitap(self):
        self.browser.find_element_by_xpath()



book = Book("Bkm kitap","Türk Askeri Kültürü")
book.google_search()

什么是完整的回溯?我猜这是触发错误的原因:
self.browser.find\u element\u by_xpath()
是否返回
None
Traceback(最后一次调用):文件“d:\python\python\u-uigulama\kitap\books.py”,第23行,打印(book.google\u-search())文件“d:\python\python\u-uigulama\kitap\books.py”,第14行,在google中搜索SearchInput=result。通过xpath('/*[@id=“input”]')查找元素。发送密钥(self.site+“”+self.book\u name)。单击()属性错误:“非类型”对象没有属性“通过xpath查找元素”
result。通过xpath('/*[@id=“input”]”)查找元素。发送密钥(self.site+“”+self.book\u name)。单击()
导致问题<代码>结果正在返回<代码>无如何解决该问题?你有什么建议吗?
结果
只是一个自动浏览器;它不返回任何内容。为了使用
find\u element\u by\u xpath