Issue locating element in IE and Chrome (Working fine in FF)

101 views
Skip to first unread message

derekmw

unread,
Jun 30, 2015, 5:23:40 PM6/30/15
to seleniu...@googlegroups.com
Hi guys,

I've been banging my head all day with this and cannot seem to find a solution.  We have this input field:

<label for='P_300449.G_300561.Q_201113' class='col-md-4 control-label'>Rep ID</label>
        <div class='col-md-8 controls'>
          <div class='input-group ifs-question-input-group'>
    <input type='text' id='P_300449.G_300561.Q_201113' class='form-control ifs-question-value' name='P_300449.G_300561.N_NewAccount^FACode' value='' maxlength='4' data-options='{"minSize":4.0,"maxSize":4.0,"eventBinders":[{"eventName":"blur","fn":"validate","context":"this"},{"eventName":"blur","fn":"_IFSMainRuleBody"}]}' title='' placeholder='' >
            <span class='input-group-btn'>
              <button type='button' class='btn btn-xs btn-default ifs-question-audit' title='For audit history click here' tabindex='-1' data-options='{"eventBinders":[{"eventName":"click","fn":"openAuditToolTip","args":["this","c918eb76-1d5b-40a3-b1ae-ae05a7257be0^201113^-1^-1^"]}]}'>
                <span class='glyphicon glyphicon-time'></span>
              </button>
              <button type='button' class='btn btn-xs btn-default ifs-question-help' title='For more help click here' tabindex='-1' data-options='{"eventBinders":[{"eventName":"click","fn":"openHelpWin","args":["this","","Modal"]}]}'>
                <span class='glyphicon glyphicon-question-sign'></span>
              </button>
            </span>
          </div>
        </div>

Through Firefox, a simple locator on id (P_300449.G_300561.Q_201113) works just fine.  I know that's not a good identifying name but just using this as an example.  The id actually never changes, just not a very useful id.

However, in IE and Chrome, selenium us unable to find the element.  I have tried using variations of xpath and css as well as id, name and other attributes without any success.  Does anyone have any ideas?

I have tried:
//*[@id=P_300449.G_300561.Q_201113]
//*[@id='P_300449.G_300561.Q_201113']
//input[@id=P_300449.G_300561.Q_201113]
//input[@id='P_300449.G_300561.Q_201113']
input[id=P_300449.G_300561.Q_201113]
input[id='P_300449.G_300561.Q_201113']

I even tried things like:
//label[text()='Rep ID']/..//input

Again, like I said, all those variations work fine in firefox but I cannot get selenium to recognize this input element at all in IE or Chrome

Mercious

unread,
Jul 1, 2015, 3:47:35 AM7/1/15
to seleniu...@googlegroups.com

derekmw

unread,
Jul 1, 2015, 9:14:52 AM7/1/15
to seleniu...@googlegroups.com
Hehe Mercious, I completely agree, it is very odd looking.  We connect to a third party tool which has these id's assigned for each field in the forms that must be filled out.  Unless they stick another field in the field before this textbox, the id will never change.  So, the scripts run and pass in Firefox everytime, but I cannot for the life of me, get these scripts to run in IE or Chrome.

I tried class name as well but no go.  

Shawn McCarthy

unread,
Jul 1, 2015, 11:24:15 AM7/1/15
to seleniu...@googlegroups.com
Have you tried looking in Chrome to see if the HTML looks the same (using chrome developer tools)?
Some more to try (CSS locators):
input[id*='P_300449.G_300561.Q_201113']
#P_300449.G_300561.Q_201113

derekmw

unread,
Jul 1, 2015, 12:05:56 PM7/1/15
to seleniu...@googlegroups.com
Below is the code in Chrome.  I don't see anything different.  I even tried just hard coding an index as such: (//input)[5] with the same results.  I almost feel like selenium just cannot see this object using IE or Chrome driver.  I tried your suggestions but also have the same issue.

<label for='P_300449.G_300561.Q_201113' class='col-md-4 control-label'>Rep ID</label>
        <div class='col-md-8 controls'>
          <div class='input-group ifs-question-input-group'>
    <input type='text' id='P_300449.G_300561.Q_201113' class='form-control ifs-question-value' name='P_300449.G_300561.N_NewAccount^FACode' value='' maxlength='4' data-options='{"minSize":4.0,"maxSize":4.0,"eventBinders":[{"eventName":"blur","fn":"validate","context":"this"},{"eventName":"blur","fn":"_IFSMainRuleBody"}]}' title='' placeholder='' >
            <span class='input-group-btn'>
              <button type='button' class='btn btn-xs btn-default ifs-question-audit' title='For audit history click here' tabindex='-1' data-options='{"eventBinders":[{"eventName":"click","fn":"openAuditToolTip","args":["this","03c8f29d-75d1-43be-926c-e94abc725c02^201113^-1^-1^"]}]}'>
                <span class='glyphicon glyphicon-time'></span>
              </button>
              <button type='button' class='btn btn-xs btn-default ifs-question-help' title='For more help click here' tabindex='-1' data-options='{"eventBinders":[{"eventName":"click","fn":"openHelpWin","args":["this","","Modal"]}]}'>
                <span class='glyphicon glyphicon-question-sign'></span>
              </button>
            </span>
          </div>
        </div>

derekmw

unread,
Jul 1, 2015, 5:17:26 PM7/1/15
to seleniu...@googlegroups.com
Ok, so whatever is different between these browsers (either the generated HTML or how the browsers render the page), using an xpath or css checker tool (just on chrome since IE doesn't have it), I cannot find the object using valid css or xpath.

So the issue isn't with selenium.  Any ideas what may cause this to happen?  I don't have enough experience here to know where to even start.  But it's apparent that this has nothing to do with selenium itself since other tools that should be able to locate this test field cannot locate the element either.

In summary:
Using xpath checker in Firefox and searching for //*[@id='P_300449.G_300561.Q_201113'] finds the element
Using xpath viewer in Chrome and searching for //*[@id='P_300449.G_300561.Q_201113'] yields no results

PeterJeffreyGale

unread,
Jul 1, 2015, 5:47:05 PM7/1/15
to seleniu...@googlegroups.com
Given just the snippet of HTML that you have provided above, searching for "//*[@id='P_300449.G_300561.Q_201113']" works in both Firefox and Chrome for me.

So the issue is likely to be caused by some other elements on the page.

You would need to provide a full standalone HTML page that we can replicate the problem on for anyone to be able to try to work out what's happening here.

Munagala Srikanth

unread,
Jul 2, 2015, 3:06:58 AM7/2/15
to seleniu...@googlegroups.com
Why can't you try with class name, there is class for that 'form-control ifs-question-value'

Regards,
Srikanth

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/4992ab63-c3b0-4382-bfb5-8741a1af3fab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

derekmw

unread,
Jul 2, 2015, 10:46:21 AM7/2/15
to seleniu...@googlegroups.com
Good idea Peter.

Attached is the frame source.  This alone replicates the issue.  Let me know if you see the issue as well.  In FF, I can easily locate the element with id.  However in IE/Chrome, it simply cannot find the element.  Any help would be greatly appreciated...especially any troubleshooting techniques you use to find out what in the html may be causing this so I can troubleshoot myself next time.
NAO.html

PeterJeffreyGale

unread,
Jul 2, 2015, 3:32:44 PM7/2/15
to seleniu...@googlegroups.com
Again, for me, the xpath locator "//*[@id='P_300449.G_300561.Q_201113']" worked fine in Firefox, Chrome and IE, both with browser based tools where available, and with Selenium based scripts.

Does this particular file exhibit the problem on your machine? What about other machines?

You mention that this is just the source for a particular frame.

Perhaps the issue lies around whether switching into the containing frame is working or not?

Are you able to identify any elements within the frame of is it just this particular element that you have an issue with?

Are you able to supply a full page including at least the containing frame in question?


derekmw

unread,
Jul 6, 2015, 10:17:05 AM7/6/15
to seleniu...@googlegroups.com
You're right, I thought it wasn't working with that file but it works.  So I'm not sure why once the frame is in the entire page, it doesn't work.  Unfortunately, I am not allowed to post the entire page.  I can see if we can get permission due to the issues being seen though.

In he meantime, is there any troubleshooting you can suggest on my end to isolate the problem?
Reply all
Reply to author
Forward
0 new messages