IwraStudios / Whatsapp-Bot

Web.whatsapp.com bot made with selenium
Mozilla Public License 2.0
39 stars 29 forks source link

Whatsapp has changed all css classes #14

Closed ricardoperovano closed 6 years ago

ricardoperovano commented 6 years ago

All the classes like 'unread', 'active' has gone, now its difficult to navigate through the elements and find unread messages!

IwraStudios commented 6 years ago

Interesting I'll need to make modular element lookups so it's easier to change

marcelocecin commented 6 years ago

you can get the number of unread messages at XPath //*[@id="pane-side"]/div/div/div/div[2]/div/div/div[2]/div[2]/div[2]/span[1]/div[2]/span

ricardoperovano commented 6 years ago

@marcelocecin I could not got it working. I tried IReadOnlyCollection<IWebElement> unread = driver.FindElements(By.XPath("//*[@id=\"pane-side\"]/div/div/div/div[2]/div/div/div[2]/div[2]/div[2]/span[1]/div[2]/span")); but it just ignore the unread messages. I also tried to work around with theses divs and spans, but no success

whatsappbot commented 6 years ago

//*[@id="pane-side"]/div/div/div/div[1]/div/div/div[2]/div[2]/div[2]/span[1]/div

Use this it's working

ricardoperovano commented 6 years ago

@whatsappbot It worked, thankyou. I need to discover all the others paths and change it. Do you use some kind of extension on chrome to get the xpath from an easier way ?

IwraStudios commented 6 years ago

@ricardoperovano there is, selenium IDE plugin, although I don't know what the compatibility is

ricardoperovano commented 6 years ago

@IwraStudios thankyou, I'm going to try it.

marcelocecin commented 6 years ago

@ricardoperovano eu pego no Safari, se precisar de mais algum caminho é só falar

ricardoperovano commented 6 years ago

@marcelocecin obrigado, agora estou conseguindo avançar.

ricardoperovano commented 6 years ago

This is what I did until now. Xpath to get unread messages: /html[1]/body[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/*/div/div/div[@class="_2EXPL CxUIE"]

Xpath to get Read Messages: /html[1]/body[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/*/div/div/div[@class="_2EXPL"]

Xpath to get the title when you loop through the messages (use it on unread webelement) /html[1]/body[1]/div[1]/div[1]/div[1]/div[2]/div[1]/div[3]/div[1]/div[1]/*/div/div/div[@class="_2EXPL CxUIE"]/div/div/div[@class="_25Ooe"]

I'm trying to get rid of the class name, but i did not figure it out how to do it, for now I need to put the class name.

adeministr commented 6 years ago

what about sending messages

ricardoperovano commented 6 years ago

@adeministr what you mean ?

adeministr commented 6 years ago

@ricardoperovano can't send messages. how can i send?

IwraStudios commented 6 years ago

@adeministr you'll need to get the text box element path and update the source

I haven't had the time to refactor element lookups yet

ricardoperovano commented 6 years ago

@IwraStudios , I've made the new element lookups, how can I contribute to your project ?

IwraStudios commented 6 years ago

@ricardoperovano Thanks for the contribution

ricardoperovano commented 6 years ago

@IwraStudios no problem!