Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

selenium whatsapp button search vba

I have a big problem !!! After a few days of normal use suddenly I can no longer select the button key number of web whatsapp!

The environment is Chrome and I use Selenium web driver ... I'm trying to do all the searches for different tags but nothing ...

This is the code

bot.wait 4000       
bot.findElementByClassName("C28xL").Click

I also tried using different parts but nothing ... even with xpath or css but maybe I'm wrong.


button search whatsapp web

Button to select.

image

<div class="gQzdc"><button class="C28xL"><div class="_1M3wR _1BC4w"><span class="" data-icon="back-blue"><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#4FC3F7" d="M20 11H7.8l5.6-5.6L12 4l-8 8 8 8 1.4-1.4L7.8 13H20v-2z"></path></svg></span></div><div class="_1M3wR _3M2St"><span class="" data-icon="search"><svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><path fill="#263238" fill-opacity=".3" d="M15.009 13.805h-.636l-.22-.219a5.184 5.184 0 0 0 1.256-3.386 5.207 5.207 0 1 0-5.207 5.208 5.183 5.183 0 0 0 3.385-1.255l.221.22v.635l4.004 3.999 1.194-1.195-3.997-4.007zm-4.808 0a3.605 3.605 0 1 1 0-7.21 3.605 3.605 0 0 1 0 7.21z"></path></svg></span></div></button><span></span><div class="_2cLHw">Cerca o inizia una nuova chat</div><label class="_2MSJr"><input value="" title="Cerca o inizia una nuova chat" dir="auto" data-tab="2" class="jN-F5 copyable-text selectable-text" type="text"></label></div>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

As per the HTML you have shared the element is a dynamic element so you have to induce Wait for the element to be clickable and you can use the following solutions:

bot.wait 4000       
bot.FindElementByXPath("//input[contains(@class,'copyable-text selectable-text') and @title='Cerca o inizia una nuova chat']").Click

Note: As an enhancement you need to replae the wait by WebDriverWait


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...