python-for-data-and-media-communication-gitbook icon indicating copy to clipboard operation
python-for-data-and-media-communication-gitbook copied to clipboard

selenium click button to select categories and search

Open ZhangNingNina opened this issue 6 years ago • 9 comments

Troubleshooting

Describe your environment

  • Operating system:OS
  • Python version:3
  • Hardware:
  • Internet access:
  • Jupyter notebook or not? [Y/N]:Y
  • Which chapter of book?:Week6

Describe your question

请问如何抓取浮窗内容呢?(是鼠标移动到某个位置才会出现的浮窗,如果将鼠标移开那个位置浮窗就消失了) 这种浮窗内容在F12的源码中是没有的,所以不知道怎么抓取…… Could someone helps me! Thanks so much! @hupili @ChicoXYC

The minimum code (snippet) to reproduce the issue

Describe the efforts you have spent on this issue

我百度过后,基本只有关于弹出窗口内容爬取的解决方案,没有找到相类似的解决方案

ZhangNingNina avatar Dec 01 '18 09:12 ZhangNingNina

@ZhangNingNina can you give me the example code of what you want to scrape?

ChicoXYC avatar Dec 01 '18 15:12 ChicoXYC

@ZhangNingNina can you give me the example code of what you want to scrape?

Sure. For example, the website here: https://www.zhipin.com/?sid=sem_pz_bdpc_dasou_title I was wondering how to scrape those industry categories on the left side of the webpage in details? It's hard to find out the source code because the detailed information appears only when i hover the cursor over it.

ZhangNingNina avatar Dec 01 '18 15:12 ZhangNingNina

@ZhangNingNina hope this may solve your problem.https://github.com/ChicoXYC/exercise/blob/master/boss-%E7%9B%B4%E8%81%98/boss%E7%9B%B4%E8%81%98.ipynb

ChicoXYC avatar Dec 01 '18 16:12 ChicoXYC

@ZhangNingNina hope this may solve your problem.https://github.com/ChicoXYC/exercise/blob/master/boss-%E7%9B%B4%E8%81%98/boss%E7%9B%B4%E8%81%98.ipynb

Thanks a lot!

ZhangNingNina avatar Dec 01 '18 16:12 ZhangNingNina

学长,这个办法貌似不适用。我们遇到的困难是,某个信息需要鼠标移到某一点才出现信息框,比如: image 但是,这个信息没有办法点击出来,网页代码也找不到诶 image @ChicoXYC

iiiJenny avatar Dec 02 '18 09:12 iiiJenny

@iiiJenny in that case, I think we can use another way to scrape. screen shot 2018-12-02 at 11 28 11 pm

screen shot 2018-12-02 at 11 28 41 pm

the sub-categories' urls in one father category increase by integers. You can formate those urls.

ChicoXYC avatar Dec 02 '18 15:12 ChicoXYC

Does this solve the hover issue: https://stackoverflow.com/a/8261754/2446356 ?

hupili avatar Dec 03 '18 15:12 hupili

@ZhangNingNina have you solved the problem? One solution is that you can format those sub-category links. 001 Like the above example: the link of java is https://www.zhipin.com/c101010100-p100101/ and the link of c++ is https://www.zhipin.com/c101010100-p100102/ you can find that, only the last number is different, which indicates we can format all the urls by this method.

Also please let me know whether the above method @hupili gave worked or not. Thanks @ZhangNingNina

ChicoXYC avatar Jan 15 '19 06:01 ChicoXYC

Sorry for my late reply. We've tried it and found this method worked. Thank you so much!!!

ZhangNingNina avatar Jan 15 '19 15:01 ZhangNingNina