when Right click is performed then an options popup/screen appears and its a dynamic content/element.
This is the Options Popup:
This dynamic content/element disappears as soon as the mouse is clicked somewhere else on the screen even if its clicked on the inspect element window the dynamic content/element disappears
there are few option to select from on the popup but in the html code there is not name or id to these options , so how can i access/select them from selenium using python ?
This is How the HTML looks :
i intend to select the option HMH NC by sending the Righ click using selenium and then making select the option but since there is no name or id for the options i can figure out how to do it
You'll have to search for it by text. I would do something like this (untested code):
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
item_labels = WebDriverWait(my_driver,5).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "div.item span.label")),
message="failed to find any menu items")
target = None
for item in item_labels:
if item.get_attribute("text") == target_value:
target = item
break
target.click()