I am trying to write a selenium code to simulate a switch on/off action.
This is the UI of that application and its actual source code under:
As we can see the label::before is mapped to "on" action, and label::after is for "off".
Following is my current python code that is not able to make such click.
def turnoff_byPlanCapacity(self):
try:
by_Plan_Capacity = "//div[contains(text(), 'Modem1 Settings')]/following-sibling:div[2]/div[2]/div[1]/div[2]/div/label"
WebDriverWait(self.driver, 20).until(EC.presence_of_element_located((By.XPATH, by_Plan_Capacity))).click()
except Exception as e:
self.logger.info(e)
raise
Does anyone know a solution for it ? Thanks a lot