Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle same name groups while exiting groups #50

Closed
NavpreetDevpuri opened this issue Oct 17, 2020 · 3 comments · Fixed by #52
Closed

Handle same name groups while exiting groups #50

NavpreetDevpuri opened this issue Oct 17, 2020 · 3 comments · Fixed by #52
Assignees
Labels

Comments

@NavpreetDevpuri
Copy link
Member

NavpreetDevpuri commented Oct 17, 2020

If we have the same name groups as follows.

from tithiwa import Tithiwa

tithiwabot = Tithiwa()
tithiwabot.open_session()
tithiwabot.create_group("Group made by tithiwa", ["Navpreet Devpuri"])
tithiwabot.create_group("Group made by tithiwa", ["Navpreet Devpuri"])
tithiwabot.create_group("Group made by tithiwa", ["Navpreet Devpuri"])
tithiwabot.exit_from_all_groups()

chrome_HkwKk6HfTD

Then it fails to exit from the 2nd and 3rd group because

  1. when we try to open the 2nd group after the 1st group it waits for the group to be opened before exiting it.
  2. it waits for the group name to appear on the chatroom
  3. But the 1st group already has the same group name
  4. So it just doesn't wait for the 2nd group to be opened
  5. it thinks like Yes we already exited that group and goes to the next one.

that's how it is skipping the same name groups.

self._wait_for_group_to_open_then_exit(groupname)

tithiwa/tithiwa/group.py

Lines 161 to 164 in 654e4f4

def _wait_for_group_to_open_then_exit(self, groupname):
print(f'Exiting from group "{groupname}"', end="... ")
self._wait_for_chat_to_open(groupname)
self._exit_from_group()

tithiwa/tithiwa/waobject.py

Lines 109 to 118 in 654e4f4

def _wait_for_chat_to_open(self, name):
nameofchat = ''
while True:
try:
nameofchat = self._wait_for_an_presence_of_element(SELECTORS.CHATROOM.NAME).get_attribute(
'innerText')
except:
pass
if nameofchat == name:
break

@NavpreetDevpuri
Copy link
Member Author

HINT: Save the previous group name HTML element in a new variable then use _wait_for_an_element_to_deattached() to wait for it to disappear then check for the next group name.

DEBUGGING helps a lot.
w2iwBUVdly

@NavpreetDevpuri
Copy link
Member Author

NavpreetDevpuri commented Oct 17, 2020

That's how we can navigate to the details of the codebase to understand something By pressing CTRL + Left mouse button
SEUi2zOGwo

@NavpreetDevpuri
Copy link
Member Author

That's how the browser's Inspect elements and console helps
gsfSeY6fQA

@NavpreetDevpuri NavpreetDevpuri self-assigned this Oct 20, 2020
@NavpreetDevpuri NavpreetDevpuri moved this from To do to Assigned in Automate essentials Oct 20, 2020
NavpreetDevpuri added a commit that referenced this issue Oct 20, 2020
Automate essentials automation moved this from Assigned to Done Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

1 participant