1

I am trying to automate the start of day procedures using selenium, I am trying to select and click a "tag" button, but no matter what way I do it there is a no element error.

I have tried XPath, css selector, class name, tag name, id, checking for iframe, checking if element is loaded. I just cant seem to get it.

This is the HTML of the website

<div class="contact-list-menu-tags">
<div class="search-item popover-content-item tag with-tooltip ">
      -------> <span class="search-item-text popover-content-item-text">call</span> <-----
<div class="tooltip __pos-center __pos-top">
<div class="tooltip-content">
<div class="ico-hover ico-s">
<div class="ico ico-pencil ico-s __alt4 __not-hovered"></div>
<div class="ico ico-pencil ico-s __gray __hovered"></div></div>
<div class="ico-hover ico-s"><div class="ico ico-trash ico-s __alt4 __not-hovered"></div>
<div class="ico ico-trash ico-s __alt1 __hovered"></div></div></div></div></div>
<div class="search-item popover-content-item tag with-tooltip "><span class="search-item-text popover-content-item-text">CEO</span><div class="tooltip __pos-center __pos-top">
<div class="tooltip-content">
<div class="ico-hover ico-s">
<div class="ico ico-pencil ico-s __alt4 __not-hovered"></div>
<div class="ico ico-pencil ico-s __gray __hovered"></div></div>
<div class="ico-hover ico-s"><div class="ico ico-trash ico-s __alt4 __not-hovered"></div>
<div class="ico ico-trash ico-s __alt1 __hovered"></div></div></div></div></div></div>

Sorry its a bit of a mess but Im not sure how to fix the formatting after copying it, the element i am trying to locate and click is the 3rd line from the top with the arrows

Here is the current code i am working on

from selenium import webdriver
import time

driver = webdriver.Chrome()
driver.get('https://www.nimble.com/') #goes to address

#login process
loginbutton = driver.find_element_by_xpath('/html/body/nav/div[1]/ul/li[8]/a')
loginbutton.click()
time.sleep(2)

username = driver.find_element_by_xpath('/html/body/form/div/div[1]/div/div[2]/input')
username.send_keys('[email protected]')

time.sleep(1)

psswrd = driver.find_element_by_xpath('/html/body/form/div/div[1]/div/div[3]/input')
psswrd.send_keys('Password112')

signin = driver.find_element_by_xpath('/html/body/form/div/div[1]/div/button')
signin.click()
time.sleep(2)

#go to contacts
driver.get('https://app.nimble.com/#app/contacts/list')
time.sleep(4)


#search tag
calltag = driver.find_element_by_css_selector('span.content')
calltag.click()
driver.find

#//*[@id="app"]/div/div[1]/div/div[1]/div[2]/div[6]/div[1]/span
#document.querySelector("#app > div > div.contact-list-menu > div > div:nth-child(1) > div.contact-list-menu-inner > div.contact-list-menu-tags > div:nth-child(1) > span")
#app > div > div.contact-list-menu > div > div:nth-child(1) > div.contact-list-menu-inner > div.contact-list-menu-tags > div:nth-child(1) > span
#<span class="search-item-text popover-content-item-text">call</span>
#/html/body/div[1]/div[1]/div/div[1]/div/div[1]/div[2]/div[6]/div[1]/span
#document.querySelector("#app > div > div.contact-list-menu > div > div:nth-child(1) > div.contact-list-menu-inner > div.contact-list-menu-tags > div:nth-child(1) > span")

The commented out stuff at the bottom is all the things i have/am trying. The username and password that are in there is just a tester account, so feel free to use it to test anything.

Thanks!

2
  • does this site have lazy loading? maybe your tag is there yet, and you'll have to wait until it is rendered. maybe try something like stackoverflow.com/a/28110129/876847 Commented Oct 19, 2020 at 6:55
  • i tried EC.presence_of_element_located but it just times out with an error message Commented Oct 19, 2020 at 7:32

1 Answer 1

1

Your element target inside a <iframe> tag, you need switch it first.

Please use .frame_to_be_available_and_switch_to_it method to handle. And for your element, you can use this xpath //span[text()="call"]

#go to contacts
driver.get('https://app.nimble.com/#app/contacts/list')
wait = WebDriverWait(driver, 20)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.ID, 'reactContactListFrame')))
element = wait.until(EC.element_to_be_clickable((By.XPATH, '//span[text()="call"]')))
element.click()
Sign up to request clarification or add additional context in comments.

2 Comments

Yeah that works, i am just wondering how you knew it was in a frame tag? I cant see any <frame> or <iframe> tags in the html?
@Drethapid the <iframe> exist in the web page, please open the inspect element in the browser then type iframe#reactContactListFrame

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.