How to browse a whole website using selenium?

前端 未结 5 810
悲哀的现实
悲哀的现实 2020-12-03 15:39

Is it possible to go through all the URIs of a given URL (website) using selenium ?

My aim is to launch firefox browser using selenium with a given URL of my choice

5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-03 16:23

    This is possible. I have implemented this using Java webdriver and URI. This was mainly created to identify the broken links.

    Using "getElements" having tag can be get using webdriver once open and save "href" value.

    Check all link status using URL class of java and Put it in stack.

    Then pop link from stack and "get" link using Webdriver. Again get all the links from the page remove duplicate links which are present in stack.

    Loop this until stack is empty.

    You can update it as per your requirements. Such as levels of traversing, excluding other links which are not having domain of the given website etc.

    Please comment if you are finding difficulty in implementation.

提交回复
热议问题