3

I generated a report through a website and I am trying to click on a link which exports the data into a csv file.

The element is:

    <span class="x21">
    <a style="color:#0000FF" href="javascript:JCRTYP('https://www.merchantconnect.com/CWRWeb/download.do?','CRCRDTYP','1','9507508464','01-FEB-2015','28-FEB-2015','14','2350','67156','WINN DIXIE 0283    S91','ALL','COMT');">
Comma Separated Value (CSV) </a>
        </span>

What I have now is to switch to the iframe and click it by the xpath. However, it throws a error "Unable to locate element". I even tried without switching to the iframe.

driver.switch_to.frame(driver.find_element_by_tag_name("iframe"))

driver.find_element_by_xpath("html/body/table/tbody/tr[1]/td/table/tbody/tr[7]/td/span[4]/a").click()

The iframe source is:

<div class="iframes">
                <iframe style="width: 100%; height: 500px" name="FRAME1" src="/CWRWeb/nova/jsp/reports/running.jsp" align="middle" frameborder="no" height="500px" width="100%"></iframe>
                </div>

Any suggestions?

Thanks

2 Answers 2

3

Switch to the iframe by name:

driver.switch_to.frame("FRAME1")

And locate the link by link text:

driver.find_element_by_partial_link_text("Comma Separated Value (CSV)")
Sign up to request clarification or add additional context in comments.

Comments

0

I found the answer, I was in the wrong frame!

Comments

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.