-1

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.

<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>

Screenshot of more html for page:

<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>

Up until Friday everything worked great. I also updated the webdriver at 2.42 and chrome was updated to 69. how can I do?

Erik A
  • 31,639
  • 12
  • 42
  • 67
Massi
  • 21
  • 9
  • This is an inherent problem with scraping data from websites in an "unapproved" manner... companies make minor or major changes to their sites all the time, and once in a while the change will mess up your scraping method, making it necessary for you to revamp your code or to start over from the beginning. – ashleedawg Sep 18 '18 at 00:23
  • What's the website's URL? Have you looked at the site's HTML to see if the element you're looking for still exists? – ashleedawg Sep 18 '18 at 00:24
  • We can't give you the locator for an element that we have only a picture of. You will need to post the relevant HTML. – JeffC Sep 18 '18 at 00:50
  • sorry I thought you knew the link.... https://web.whatsapp.com/ the key still exists and its HTML seems to me the same, but I do not have much experience. The name of the key is always the same. – Massi Sep 18 '18 at 06:23
  • sorry, I can not use the snippet tool...I have published an image of the code – Massi Sep 18 '18 at 07:08
  • I tried ... see if you understand. however, there is no error, simply the button is not clicked and the routine continues wrong or crashes later. – Massi Sep 18 '18 at 07:32
  • ....news for me? – Massi Sep 18 '18 at 12:15

1 Answers1

1

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

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • How do you recognise it is a dynamic element from the html please? – QHarr Sep 18 '18 at 18:22
  • @QHarr If you look at the `class` attributes within the HTML which OP have provided these classes e.g. **gQzdc**, **C28xL** etc are [JavaScript](https://www.javascript.com/) generated classes which are bound to change time to time. Further the some of the other `class` attributes e.g. `_1M3wR`, `_1BC4w` etc are [ReactJS](https://reactjs.org/) based classes which may not be present during the next session. Hence we can conclude the elements having those _class attributes_ are dynamic element. – undetected Selenium Sep 19 '18 at 19:18
  • 1
    @QHarr I have embedded the links for your reference. Being able to identify js/react based/generated elements would definitely help us to identify the dynamic nature of the _AUT_ which we can consider while interpreting HTML DOM. – undetected Selenium Sep 19 '18 at 19:25