<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28754</bug_id>
          
          <creation_ts>2015-06-04 16:18:45 +0000</creation_ts>
          <short_desc>In section 11, it is not clear when to return no such element error</short_desc>
          <delta_ts>2015-10-26 05:40:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Browser Test/Tools WG</product>
          <component>WebDriver</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>Windows NT</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>20860</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="John Jansen">johnjan</reporter>
          <assigned_to name="Browser Testing and Tools WG">public-browser-tools-testing</assigned_to>
          <cc>ato</cc>
    
    <cc>james</cc>
    
    <cc>mike</cc>
          
          <qa_contact name="Browser Testing and Tools WG">public-browser-tools-testing</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>120703</commentid>
    <comment_count>0</comment_count>
    <who name="John Jansen">johnjan</who>
    <bug_when>2015-06-04 16:18:45 +0000</bug_when>
    <thetext>&quot;Return a no such element error.&quot;

I believe this is just missing an &apos;else&apos; but didn&apos;t want to make that change myself.

CURRENT:

To get a known web element with a UUID reference:

For each web element in the current browsing context’s set of known web elements:

If web element’s web element reference matches reference, return web element.
Return a no such element error.

PROPOSED:

To get a known web element with a UUID reference:

For each web element in the current browsing context’s set of known web elements:

If web element’s web element reference matches reference, return web element.
Else, return a no such element error.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120704</commentid>
    <comment_count>1</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2015-06-04 16:25:47 +0000</bug_when>
    <thetext>I think this is just an early return. I agree it might be clearer without (I think it would be much much better to use the success/error machinery here, as in:

To get a known web element with a UUID reference:

If there is an element in the browsing current context&apos;s set of known elements whose web element reference is reference, return success with data element.

Otherwise, return error with status no such element.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120706</commentid>
    <comment_count>2</comment_count>
    <who name="James Graham">james</who>
    <bug_when>2015-06-04 16:37:34 +0000</bug_when>
    <thetext>Oh, ato pointed out that this text is the subject of PR #76 anyway.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120711</commentid>
    <comment_count>3</comment_count>
    <who name="Andreas Tolfsen">ato</who>
    <bug_when>2015-06-04 17:12:39 +0000</bug_when>
    <thetext>This is just an early return, in pseudo code:

    for el of els {
        if el == expected {
            return el
        }
    }
    return error

That is a simplistic version of how I would implement it.  In reality I would use a more performant search algorithm.  What we’re trying to say is that “find the entry on list that matches this other element I have”.

I find it weird to use an else clause because I’ve never encountered a for loop construct that has one.

I should also add that there’s an open PR to improve the web element lookup: https://github.com/w3c/webdriver/pull/76</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>