Answer the question
In order to leave comments, you need to log in
How to simulate a click or unlock hidden data?
There is an avito page. There are two buttons on each page, one "Write a message" - which creates a dialogue with
the owner
of this ad, the other "Show phone". Show the full owner number
What I tried to do for the task - 1
Each ad has a number, which is obvious
https://www.avito.ru/ufa/nastolnye_kompyutery/4_ya... 1412710700
Each dialog also has a code that includes in yourself your code and the ad code you are applying for
https://www.avito.ru/profile/messenger/channel/u2i- 1412710700-87061295
But there is one BOLD BUT - if I take my code and the code of any ad and substitute them in the dialog URL, then the page will not exist for those ads for which I did not click the "Write a message" button.
I also tried to study the page code to get the link of the "Write a message" button - it doesn't exist.
The second task is completely similar to the first one
. From here, the question is, how can I press any of these buttons with a PYTHON script.
I would be very grateful both for a direct answer in the form of a code, and for any links to articles on modules that can solve my problem both in Russian and in English
Answer the question
In order to leave comments, you need to log in
selenium
...
driver.get('https://www.avito.ru/rostov-na-donu/zapchasti_i_aksessuary/akpp_infiniti_vq37vhr_g37_1791599363')
el = driver.find_element_by_xpath("//button[contains(@data-marker, 'item-phone-button/card')]")
el.click()
el = driver.find_element_by_xpath("//img[contains(@data-marker, 'phone-popup/phone-image')]")
image = Image.open(io.BytesIO(base64.b64decode(el.get_attribute('src').split(',')[1])))
imshow(image)
Heavy everyday life of a copier ...
1. Avito's muzzle, like many others, is written in JS and has nothing to do with the backend (It generally doesn't care what kind of YaP), except for requests.
2. DOM is generated dynamically depending on user actions.
3. You will never see all this when poking around in the raw files, since the DOM is already shown in the debugger (F12).
Total:
From here - the question is how do I press any of these buttons with a PYTHON script
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question