0

I would like to automate click on a link with selenium in a web page. The problem I am facing is that Selenium doesn't recognize all elements included in a div. I've tried to locate it with id, cssSelector and even with Xpath it's not working. I've tried also Selenium IDE which seems not able to locate elements included in that div (it locates only the entire div).

Have you an idea please from what this problem can came from?

Here is the HTML section I would like to access to:

<div>
    <script type="text/javascript">
    <script type="text/javascript">
    <div id="ctl00_Main_ctl00_TabTransactions" class="tabs ui-tabs ui-widget ui-widget-content ui-corner-all" style="height: 444px">
    <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">
        <li class="ui-corner-top ui-state-default">
        <li class="ui-corner-top ui-tabs-selected ui-state-active">
        <a href="#ctl00_Main_ctl00_PanelTransactionMcc">Mcc</a>
        </li>
        <li class="ui-corner-top ui-state-default">
        <li class="ui-state-default ui-corner-top">
    </ul>
    <div id="ctl00_Main_ctl00_PanelTransactions" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
    <div id="ctl00_Main_ctl00_PanelTransactionMcc" class="ui-tabs-panel ui-widget-content ui-corner-bottom">
    <div id="ctl00_Main_ctl00_TabPanelservice" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
    <div id="ctl00_Main_ctl00_TabPanelLimitsSettings" class="ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide">
</div>
<div id="ctl00_Main_ctl00_upTrxModal"> </div>
    <input id="hdnimgloaderid" type="hidden" value="loading_transactions">
    <script src="/js/jquery.contextMenu.js" type="text/javascript">
    <script type="text/javascript">
    <script type="text/javascript">
</div>

I am trying to click on <a href="#ctl00_Main_ctl00_PanelTransactionMcc">Mcc</a> with :

driver.findElement(By.linkText("Mcc")).click();

But it's not working neither.

Thank you in advance.

Bek
  • 261
  • 3
  • 11
  • What do you mean by not working?? is there any exception??? – Saurabh Gaur Jul 15 '16 at 13:40
  • No Exception is returned, it simply freezes on click on "Mcc" link line. – Bek Jul 15 '16 at 13:56
  • As I seeing in this link there is no url...so could you please let me know what does this link when clicking manually?? – Saurabh Gaur Jul 15 '16 at 14:02
  • This link is a tab in the web page I am working on. When I click on it, It displays "Mcc" tab which contains some checkbox. – Bek Jul 15 '16 at 14:11
  • 1
    Actually, I finally succeeded to acces to Mcc link. I couldn't access it because it was included into a frame. The problem was solved by switching to the correct frame. – Bek Jul 15 '16 at 15:41
  • @Bek Just to finish the story: If you solved your question, you should add an answer with solution details, so that others might learn from it. – Würgspaß Jul 15 '16 at 16:39

1 Answers1

0

Actually, I finally succeeded to acces to Mcc link. I couldn't access it because it was included into a frame. The problem was solved by switching to the correct frame.

driver.switchTo().frame(0);
System.out.println("Switching successfull");
driver.findElement(By.xpath("/html/body/form/div[3]/div[1]/ul/li[2]/a")).click();
Bek
  • 261
  • 3
  • 11