Enviado em 26/03/2020 - 21:57h
Boa noite coelgas,selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//div[contains(@class, '2S1VP')]"}
self.caixa_de_pesquisa = self.driver.find_element_by_xpath("//div[contains(@class, '2S1VP')]")
import os
import time
import re
import requests
import json
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
from selenium import webdriver
class wppbot:
dir_path = os.getcwd()
def __init__(self, nome_bot):
print(self.dir_path)
self.bot = ChatBot(nome_bot)
#self.bot.set_trainer(ListTrainer)
self.trainer = ListTrainer(self.bot)
#self.trainer.train(self.conversas)
self.chrome = self.dir_path+'/chromedriver'
self.options = webdriver.ChromeOptions()
self.options.add_argument(r"user-data-dir="+self.dir_path+"/profile/wpp")
self.options.add_argument('--headless')
self.options.add_argument('--no-sandbox')
self.options.add_argument('--disable-dev-shm-usage')
self.driver = webdriver.Chrome(self.chrome, chrome_options=self.options)
def inicia(self,nome_contato):
self.driver.get('https://web.whatsapp.com/')
self.driver.implicitly_wait(20)
self.caixa_de_pesquisa = self.driver.find_element_by_xpath("//div[contains(@class, '2S1VP')]")
self.caixa_de_pesquisa.send_keys(nome_contato)
time.sleep(2)
print(nome_contato)
self.contato = self.driver.find_element_by_xpath('//span[@title = "{}"]'.format(nome_contato))
self.contato.click()
time.sleep(2)
Atualizando o Passado: Linux no Lenovo G460 em 2025
aaPanel - Um Painel de Hospedagem Gratuito e Poderoso
O macete do Warsaw no Linux Mint e cia
Um modo leve de ouvir/ver áudio/vídeo da internet em máquinas pererecas
Resolver algumas mensagens de erro do SSH
Instalar módulo de segurança do Banco do Brasil Warsaw do tipo .run
Sem espaço na partição home (2)
O que você está ouvindo agora? [2] (190)
Procrastinação e autossabotagem são problemas muito comuns na sociedad... (5)