我一直在基于此处的提交{@ {3}}
来开发一个whatsapp聊天机器人项目。WhatsApp端似乎发生了一些变化,使我得到以下错误:
https://github.com/VISWESWARAN1998/Simple-Yet-Hackable-WhatsApp-api
它之前运行良好,但是突然间停了下来。有人有可行的解决方案吗?我相信其中可能有问题的代码部分是这样的:
def __init__(self, wait, screenshot=None, session=None):
chrome_options = Options()
if session:
chrome_options.add_argument("--user-data-dir={}".format(session))
self.browser = webdriver.Chrome(options=chrome_options) # we are using chrome as our webbrowser
else:
self.browser = webdriver.Chrome()
self.browser.get("https://web.whatsapp.com/")
# emoji.json is a json file which contains all the emojis
with open("emoji.json") as emojies:
self.emoji = json.load(emojies) # This will load the emojies present in the json file into the dict
WebDriverWait(self.browser,wait).until(EC.presence_of_element_located(
(By.CSS_SELECTOR, '._2S1VP')))
if screenshot is not None:
self.browser.save_screenshot(screenshot) # This will save the screenshot to the specified file location
特别是(通过CSS_SELECTOR,“ ._ 2S1VP”)
我尝试将._2S1VP交换为通过检查浏览器上的WhatsApp页面而发现的其他东西,但是没有这种运气。非常感谢您的投入!
谢谢。