G
G
George2021-04-14 09:36:03
Parsing
George, 2021-04-14 09:36:03

Grabbing - why does the mouse not click on the element?

Good afternoon.
I'm trying to rob fl.ru for myself under a certain filter "Layout".
To quickly notice new projects.
To do this, I use nodeJS and the puppeteer library to set the desired project filter by simulating a mouse click. However, the last mouse click for some reason does not work.
I can't understand why?
Here is the code:

const fs = require('fs');
const puppeteer = require('puppeteer');
const url = 'https://www.fl.ru/projects/';

(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto(url);
  await page.click('.b-combo__arrow');

  try{
    await page.addStyleTag({path : './my-css.css'})
    await page.click('.b-combo__body_left > .b-combo__list > .b-combo__item:first-child');
    await page.click('.b-layout__right_bordleft_cdd1d3 .b-combo__list > .b-combo__item:first-child');
    await page.click('.b-layout__right_bordleft_cdd1d3 .b-combo__list > .b-combo__item:first-child > span');
  }
  catch (err){
    console.log('\n\n-----------Error description beginning-----------\n');
    console.log(err);
    console.log('\n-----------Error description end-----------\n\n')
    await browser.close();
  }
  
  await page.pdf({path: './page.pdf'}); 
  await browser.close();
})();


If you look at the pdf image of the page, you will see that all the filters are open, but the decisive click that will add the filter is not pressed.
60768cf033784184746997.png
Help me to understand.

Maybe there are some simpler ways to rob the desired category of projects than simulating mouse clicks?

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dkrylov, 2021-04-15
@dkrylov

1) Do you need to click exactly on > span at the end?!
2) Try xPath directly to use
3) Logs of actions (where the error crashes) also lay out something like that, one could immediately tell from them

K
Kirill Gorelov, 2021-04-15
@Kirill-Gorelov

I parsed already somehow fl.
There the usual static page is generated. As already mentioned in the comments, there is no need for a browser.
How I did it.
I typed the filter I needed, the filter itself is displayed in the get (I don’t remember right now) parameter. And then I pulled a specific url and parsed the orders I needed from there ....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question