mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-14 13:55:43 +00:00
Bug 1204496: When searching by link text start from the startNode and not the rootNode; r=ato
--HG-- extra : commitid : B41EB2spDLA extra : rebase_source : 19077dc84eefe0b11d862c04dc1f8bbc595cca82
This commit is contained in:
parent
5f70fae987
commit
cf7ee31873
@ -169,3 +169,11 @@ class TestElements(MarionetteTestCase):
|
||||
self.assertIsNotNone(re.search(uuid_regex, el.id),
|
||||
'UUID for the WebElement is not valid. ID is {}'\
|
||||
.format(el.id))
|
||||
def test_should_find_elements_by_link_text(self):
|
||||
test_html = self.marionette.absolute_url("nestedElements.html")
|
||||
self.marionette.navigate(test_html)
|
||||
element = self.marionette.find_element(By.NAME, "div1")
|
||||
children = element.find_elements(By.LINK_TEXT, "hello world")
|
||||
self.assertEqual(len(children), 2)
|
||||
self.assertEqual("link1", children[0].get_attribute("name"))
|
||||
self.assertEqual("link2", children[1].get_attribute("name"))
|
||||
|
@ -0,0 +1,9 @@
|
||||
<!DOCTYPE html>
|
||||
<a href="1.html">hello world</a>
|
||||
<a href="1.html">hello world</a><a href="1.html">hello world</a>
|
||||
<div name="div1">
|
||||
<a href="2.html" name="link1">hello world</a>
|
||||
<a href="2.html" name="link2">hello world</a>
|
||||
</div>
|
||||
|
||||
<a href="1.html">hello world</a><a href="1.html">hello world</a><a href="1.html">hello world</a>
|
@ -681,7 +681,7 @@ ElementManager.prototype = {
|
||||
break;
|
||||
case LINK_TEXT:
|
||||
case PARTIAL_LINK_TEXT:
|
||||
let allLinks = rootNode.getElementsByTagName('A');
|
||||
let allLinks = startNode.getElementsByTagName('A');
|
||||
for (let i = 0; i < allLinks.length; i++) {
|
||||
let text = allLinks[i].text;
|
||||
if (PARTIAL_LINK_TEXT == using) {
|
||||
|
Loading…
Reference in New Issue
Block a user