Does anyone know why this happens?
The first selector clicks on the menu
The second selector clicks on the menu option that only loads and gets added to the DOM after the first is clicked
1) site loads
2) i run the following code to fetch dom elements via the web developer console
Expand|Select|Wrap|Line Numbers
- function fetchElement(){
- document.querySelectorAll('[data-menu="menu"]')[0].click()
- document.querySelectorAll('[data-option="menuitem"]')[0].click()
- }
- fetchElement()
I am wondering if it's because those menuitems get added to the DOM after the first click? So it's not actually there, but if that's the case how would I access those elements?
Thank You,
DT