0

I want to capture the web element highlighted in the below screenshot:

inspect element for'Deployments'

I have already tried following options (using absolute as well as relative path):

  1. submit = driver.find_element_by_xpath("html/body/vra-root/vra-shell/clr-main-container/vra-tabs/nav/ul/li[2]/a").click()
  2. submit = driver.find_element_by_xpath("//ul[@class='nav']//li[@class='nav-item ng-star-inserted']//a[@id='csp.cs.ui.deployment'] and contains [text()='Deployments']").click()
  3. submit = driver.find_element_by_xpath("//a[text()='Deployments']").click()
  4. content = driver.find_element_by_css_selector('a.nav-link').click()

But, everytime I am getting the follwing error message`NoSuchElementException: Message: no such element: Unable to locate element:

I am new to this, any help is appreciated!`

0

2 Answers 2

0

This looks like in an iframe, if yes then you can switch it to iframe first like this :

WebDriverWait(driver, 10).until(EC.frame_to_be_available_and_switch_to_it((By.XPATH,"iframe xpath")))

and then click :

driver.find_element_by_xpath("//a[text()='Deployments']").click()
Sign up to request clarification or add additional context in comments.

3 Comments

where do you see iframe in that screenshot? I guess it's possible that it exists, but we need to see more of the HTML to know for sure
This looks like in an iframe read this. OP has tried almost all way to click on it and got NoSuchEement exception so it could be in iframe. but that is my guess, waiting for OP to share his feedback and then can give proper solution
Thanks @cruisepandey. It was an iframe issue. It resolved now.
0

If it's not an iframe issue as @cruisepandy described then try adding a wait around it to see if that helps

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC


wait = WebDriverWait(driver, 10)

submit = wait.until(EC.element_to_be_clickable((By.XPATH, "//a[text()='Deployments']")))
submit.click()

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.