I'm attempting to modify this project
https://github.com/oborys/Selenium_automation_Adding_Cisco_Meraki_VPN_exclusion_rules to the current dashboard setup. I'm running into some issues with the 'add' button on the 'Local internet breakout' box.
I've tried several methods for the locator with various errors.
for ipPort in ipListAndPort:
lst = ipPort.split(';')
IP = lst[0]
ports = lst[1]
for port in ports:
print("IP ", IP, " Ports ", port)
time.sleep(3)
#button = driver.find_element(By.TAG_NAME, "//a[@class='btn btn-default']")
#button = driver.find_element(By.TAG_NAME, "fa fa-plus plus")
#button = driver.find_element(By.TAG_NAME, 'add')
#button = WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.ID, "btn btn-default")))
#button = WebDriverWait(driver, 10).until(By.CSS_SELECTOR, "a[class='btn btn-default']")
button = WebDriverWait(driver, 10).until(By.XPATH, "//a[@class='btn btn-default']")
time.sleep(1)
button.click()
Using selectors hub I've confirmed the XPATH is //a[@class='btn btn-default'] but when I debug I get the error
'str' object is not callable
I haven't been able to locate the actual ID to try that. Inspecting the element I see that the below section contains the "Add"
<a class="btn btn-default" data-toggle="dropdown" data-domplate="href" href="#rule_menu_vpn_exclusion_shaper">
Add
<i class="fa fa-plus plus"></i>
</a>
If I try by tag name I get the error
Message: no such element: Unable to locate element: {"method":"tag name","selector":"//a[@class='btn btn-default']"}
Message: no such element: Unable to locate element: {"method":"tag name","selector":"fa fa-plus plus"}
Message: no such element: Unable to locate element: {"method":"tag name","selector":"add"}
If there is a better method for this I'm open to it but I didn't have much luck using autogui and I'd like this to be able to work from multiple pcs so using selenium would be preferred.