This is quite a common issue for ecommerce sites. The trick is to create a wrapper (container) for all the category results you want, then make that wrapper a child of all the categories you will navigate to, i.e. child of Category L1, Category L2, etc. You would then build your scrapers under this category results wrapper. As the same wrapper will handle all the categories, this will provide the needed flexibility to handle categories with different depths.
This concept can be a bit hard to understand so you can try importing the example sitemap
below, which scrapes the webscraper test site: You can open Selector graph to see how it is structured:
{"_id":"category-scrape-demo","startUrl":["https://webscraper.io/test-sites/e-commerce/allinone"],"selectors":[{"id":"Click L1 categories","type":"SelectorLink","parentSelectors":["_root"],"selector":"a.category-link","multiple":true },{"id":"Category results wrapper","type":"SelectorElement","parentSelectors":["Click L1 categories","Click L2 categories"],"selector":"div.row > div.col-md-9","multiple":false },{"id":"Click L2 categories","type":"SelectorLink","parentSelectors":["Click L1 categories"],"selector":"a.subcategory-link","multiple":true },{"id":"Category title","type":"SelectorText","parentSelectors":["Category results wrapper"],"selector":"h1","multiple":false,"regex":"" },{"id":"Item wrappers","type":"SelectorElement","parentSelectors":["Category results wrapper"],"selector":"div.thumbnail","multiple":true },{"id":"Product name","type":"SelectorText","parentSelectors":["Item wrappers"],"selector":"h4 > a","multiple":false,"regex":"" },{"id":"Desc","type":"SelectorText","parentSelectors":["Item wrappers"],"selector":"p.description","multiple":false,"regex":"" },{"id":"Price","type":"SelectorText","parentSelectors":["Item wrappers"],"selector":"h4.pull-right.price","multiple":false,"regex":"" },{"id":"Link","type":"SelectorLink","parentSelectors":["Item wrappers"],"selector":"h4 > a","multiple":false }]}