I am still quite new to python and selenium, However have managed to get quite far with what I am doing. But I appear to now be stuck. The page in question is an internal business page. I have tried using ID, name and XPATH with very little success.
from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver import ActionChains import time PATH = r"C:Usersp819364Downloadschromedriver.exe" options = webdriver.ChromeOptions() options.add_argument('--ignore-ssl-errors=yes') options.add_argument('--ignore-certificate-errors') driver = webdriver.Chrome(PATH, options=options) driver.get("https://10.47.31.102/3/Login") driver.implicitly_wait(15) print (driver.title) username = driver.find_element(By.NAME, value='j_username') username.send_keys("username") password = driver.find_element(By.NAME, value='j_password') password.send_keys("password") password.send_keys(Keys.RETURN) driver.implicitly_wait(20) Settings = driver.find_element(By.XPATH, value="//*[@id='evo_widget_TBFisheyeItem_4']") Settings.click() driver.implicitly_wait(20) Filter = driver.find_element(By.XPATH, value="//*[@id='tableForm:authenticationPolicyTable:tableActions']") driver.implicitly_wait(20) Filter.click()
The problem I am having is with the filter, I think it may be because this is a page within a page. I am sorry I cannot share the page as its internal. But I need to be able to click the filter and click and options
I keep getting the following error
Message: no such element; Unable to locate element: {"method":"css selector","selector":["//*[@id='tableForm:authenticationPolicyTable:tableActions']"
The XPATH is as follows: //*[@id=”tableForm:authenticationPolicyTable:tableActions”]
This is the full XPATH (which I have tried): /html/body/form[3]/table/thead/tr[1]/th/table/tbody/tr/td[2]/select
I appreciate any help given and I also am not sure if its caused this because the field I want to select is not in view until I scroll. However I cannot seem to scroll as the element is within another as pictured
Thanks
Edit:
The iFrame was stopping it i had to switch to it first
iframe = driver.find_element_by_xpath("//*[@id='consoleCanvas']") driver.switch_to.frame(iframe)
Advertisement
Answer
I think if the page is within page then you need to check if that element is within iframe. If iframe is there then you should first switch to frame and then click on filter. If you can post html code then it will be easy to understand issue.