Skip to content
This repository has been archived by the owner on Jan 27, 2025. It is now read-only.

Fix search content description case #114

Merged
merged 1 commit into from
Sep 24, 2020

Conversation

arthurspa
Copy link
Collaborator

Instagram app has updated the search content
description text case from 'Search and Explore'
to 'Search and explore'. This is causing the bot to
brash.

@arthurspa
Copy link
Collaborator Author

This commit fixes #113

Instagram app has updated the search content
description text case from 'Search and Explore'
to 'Search and explore'. This is causing the bot to
brash.

Now we use a case insensitive regex to find the
description.
@arthurspa arthurspa force-pushed the fixSearchContentDescCase branch from 6d439d2 to 3a00c9b Compare September 23, 2020 08:11
@gvmturl
Copy link
Collaborator

gvmturl commented Sep 23, 2020

Hey @arthurspa provided solution does not solve #113

@arthurspa
Copy link
Collaborator Author

arthurspa commented Sep 23, 2020

Hi @gvmturl , I check the logs in #113 , it's exactly the same problem I was having when I cloned the repo yesterday.
I only managed to run the bot when I fixed the string case as in my commit. If I remove this fix it stops working, at least for me.

In the logs of #113 I can see that it fails to find description: 'Search and Explore'. Then I inspected the layout for the latest Instagram release and realised they changed that string to 'Search and explore'.

Traceback (most recent call last):
  File "insomniac.py", line 385, in wrapper
    func(*args, **kwargs)
  File "insomniac.py", line 193, in job
    on_interaction)
  File "C:\Users\filip\Insomniac\src\action_handle_blogger.py", line 33, in handle_blogger
    if not _open_user_followers(device, username):
  File "C:\Users\filip\Insomniac\src\action_handle_blogger.py", line 47, in _open_user_followers
    navigate(device, Tabs.SEARCH)
  File "C:\Users\filip\Insomniac\src\navigation.py", line 14, in navigate
    _navigate_to_search(device)
  File "C:\Users\filip\Insomniac\src\navigation.py", line 96, in _navigate_to_search
    search_in_action_bar.click()
  File "C:\Users\filip\Insomniac\src\device_facade.py", line 144, in click
    raise DeviceFacade.JsonRpcError(e)
src.device_facade.DeviceFacade.JsonRpcError: -32002 Client error: <> data: Selector [childOrSibling=['child'], childOrSiblingSelector=[{'mask': 64, 'childOrSibling': [], 'childOrSiblingSelector': [], 'description': 'Search and Explore'}], 

Could you share the logs of the crash again but running with my commit?

Thank you.

@randinfo
Copy link

[09/24 20:45:39] Traceback (most recent call last):
  File "/Users/amar/Documents/dev/insomniac/src/device_facade.py", line 142, in click
    self.viewV2.click(UI_TIMEOUT_LONG)
  File "/Users/amar/anaconda3/lib/python3.7/site-packages/uiautomator2/_selector.py", line 150, in click
    self.must_wait(timeout=timeout)
  File "/Users/amar/anaconda3/lib/python3.7/site-packages/uiautomator2/_selector.py", line 345, in must_wait
    raise UiObjectNotFoundError({'code': -32002, 'data': str(self.selector), 'method': 'wait'})
uiautomator2.exceptions.UiObjectNotFoundError: -32002 Client error: <> data: Selector [childOrSibling=['child'], childOrSiblingSelector=[{'mask': 256, 'childOrSibling': [], 'childOrSiblingSelector': [], 'descriptionMatches': '[Ss]earch and [Ee]xplore'}], resourceId='com.instagram.android:id/action_bar', className='android.widget.LinearLayout'], method: None

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "insomniac.py", line 385, in wrapper
    func(*args, **kwargs)
  File "insomniac.py", line 193, in job
    on_interaction)
  File "/Users/amar/Documents/dev/insomniac/src/action_handle_blogger.py", line 33, in handle_blogger
    if not _open_user_followers(device, username):
  File "/Users/amar/Documents/dev/insomniac/src/action_handle_blogger.py", line 47, in _open_user_followers
    navigate(device, Tabs.SEARCH)
  File "/Users/amar/Documents/dev/insomniac/src/navigation.py", line 14, in navigate
    _navigate_to_search(device)
  File "/Users/amar/Documents/dev/insomniac/src/navigation.py", line 96, in _navigate_to_search
    search_in_action_bar.click()
  File "/Users/amar/Documents/dev/insomniac/src/device_facade.py", line 144, in click
    raise DeviceFacade.JsonRpcError(e)
src.device_facade.DeviceFacade.JsonRpcError: -32002 Client error: <> data: Selector [childOrSibling=['child'], childOrSiblingSelector=[{'mask': 256, 'childOrSibling': [], 'childOrSiblingSelector': [], 'descriptionMatches': '[Ss]earch and [Ee]xplore'}], resourceId='com.instagram.android:id/action_bar', className='android.widget.LinearLayout'], method: None

@alexal1 alexal1 merged commit c898806 into alexal1:master Sep 24, 2020
@alexal1
Copy link
Owner

alexal1 commented Sep 24, 2020

@arthurspa works like a charm, thank you!

@alexal1 alexal1 mentioned this pull request Sep 24, 2020
@randinfo
Copy link

are you sure mate ? i used right now with these modifications and i still get the error

@alexal1
Copy link
Owner

alexal1 commented Sep 24, 2020

@randinfo please try it on v2.1.7

@arthurspa arthurspa deleted the fixSearchContentDescCase branch September 24, 2020 21:46
singulart pushed a commit to singulart/Insomniac-old that referenced this pull request Mar 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants