Cooperisduhace
Cooperisduhace

Reputation: 135

element is not clicked [selenium]

I am using selenium2library(python) for our automation. this is the method is used

def get_appointment_from_manage(self, date, appt_id):
    ref_date = "//*[@data-date=\"%s\"]" % date
    time.sleep(2)
    logging.info(date)
    logging.info(appt_id)
    while not self.is_element_present_by_xpath(ref_date) :
        self._current_browser().find_element_by_xpath("//*[@id=\"calendar1\"]/div[1]/div[3]/div/button[2]").click();
    time.sleep(2)
    element = self._current_browser().find_element_by_xpath("//*[@data-aid=\"%s\"]" % appt_id)
    logging.info(element)

    ActionChains(self._current_browser()).move_to_element(element).click().perform()

The logging states that the element was found but it doesn't click. this is the part that isn't clicking.

    element = self._current_browser().find_element_by_xpath("//*[@data-aid=\"%s\"]" % appt_id)
    logging.info(element)

    ActionChains(self._current_browser()).move_to_element(element).click().perform()

When you inspect the element, the whole element is covered in blue. So I don't know what am i missing. Firefox version is 28. Thanks in advance!

EDIT

This is the html

<div class="fc-event-container">
    <div class="fc-event-box" style="position:relative;z-index:1"></div>
    <div data-aid="31" class="fc-event-data-container fc-status-2" style="position:absolute;top:0px;right:0;bottom:-62px;left:0;z-index:1">
        <div class="fc-event-data-box">
            <a class="fc-time-grid-event fc-event fc-start fc-end evnt-1419408000000" style="top: 0px; bottom: -62px; z-index: 1; left: 0%; right: 0%;">
                <div class="fc-content">
                    <div class="fc-time" data-start="8:00" data-full="8:00 AM - 8:30 AM" style="display:none;">
                        <span>8:00 - 8:30</span>
                    </div>
                    <div class="fc-title">Robot-FN</div>
                    <span class="fc-product">Home Loans</span>
                </div>
                <div class="fc-bg"></div>
            </a>
        </div>
    </div>
</div>

Upvotes: 0

Views: 131

Answers (1)

Elisha
Elisha

Reputation: 4951

I'm not sure this what you are trying, but if you want to click on the <a> tag (which is clickable), then, you need to hold that element, not the <div> that contains it.

try somthing like this: (I didn't try this xpath so take it as a general idea)

element = self._current_browser().find_element_by_xpath("//*[@data-aid=\"%s\"]//a" % appt_id)

Upvotes: 1

Related Questions