Saturday 24 October 2020

Release 0.2.3 - Avoiding Boring People with Chat Automation

 


Hello my wonderful followers, aka my professor.

These past two weeks have been a nightmare for me (and many of my colleagues). This is due to the overwhelming amount of work that I have to do in my final year of my Computer Science program. #ThanksGeorge... BTW, George is my game development professor.

Anyways...
I will begin this blog by asking a question. Have you spent too much time on social media? Do you have boring/ignorant people that chat with you on a regular basis but you just have no interest in talking to them at this specific time? Yeah, you know who I am talking about. AND, if you don't know/have, you are one of those people.

So this week I decided to break away from the VR scene and continue my studies on my automation skill set. I found this really cool github with all kinds of automation bots that do various kinds of things. I found the most "popular" repo which was on the whatsapp platform. I saw one issue that still had no assignee so I acted quick. When I say quick I mean I commented asking to take on this issue quicker than my girlfriend changing her mind about where she wants to eat (and that's quick).
I got assigned to it probably within the hour.

Anyways, the issue was not hard at all. It was to replace some code with a modified version of an already made CSS selection "library". It really was not rocket science and any python beginner could do it. Now, re-read what I just said....
YEP, Python. 
But, Why Plamen, I thought you couldn't stand python and that the snek and you despised each other.
Yeah, well... I don't know, I really do not have an explanation to it. Maybe I enjoy being punished, maybe I am a masochist. Who knows.
No, the actual reason was that it was using selenium and I have a little experience with selenium from my 0.1 release. I wanted to see what else selenium can do so I forced myself to slowly start learning python.

Moving on.

I began to do exactly what was asked of me and began making the appropriate changes, as follow:
# from 
MAIN_SEARCH_BAR = '._3FRCZ'
EC.presence_of_element_located((By.CSS_SELECTOR, selector))
relement = element.find_element(By.CSS_SELECTOR, selector)

# to 
MAIN_SEARCH_BAR = (By.CSS_SELECTOR, '._3FRCZ')
EC.presence_of_element_located(selector)
relement = element.find_element(selector[0], selector[1])
 and so on...
I made my PR and it got merged the next day.
I thought this was not enough though so I looked through the person's other repos and saw they had began making a similar automation bot for facebook, a dying social media platform.

This issue was a bit more challenging as I had to make the base file for opening a browser with facebook as opposed to whatsapp and retain similar logic to his whatsapp file waobject.py 
I fiddled my thumbs around for a little bit and began examining how his code exactly worked. I soon realized that he did not want me to make any implementations but simply make the base file to open a session with facebook. Kinda lame but gotta give the people what they want I guess.
I finished my implementation and sent him a quick PR. Honestly, I believe that two small fixes/contributions were enough to call a combined 3rd PR for my 0.2.3 release. 
I just hope my professor sees it like that.
Even if they were not I came out with a lot more knowledge of python and selenium than going in. Quite frankly I enjoyed contributing to this person's repo as automation is becoming a more popular and growing idea of the current times. 

Well that was it for this week my friends. Short and sweet (again...)

Till next time, 
XOXO, 
Gossip Plamen

No comments:

Post a Comment

Release 0.4.3 - The End of Something Great

  Hello my wonderful followers! It is here... It is finally here. The end of this nightmarish semester is finally here. I have to say the pa...