Update web-platform-tests to revision 238e9855c35a3570f824b837826aac71e50722f4

This commit is contained in:
Josh Matthews 2017-10-16 17:10:28 -04:00
parent 20a833eb75
commit cb9490cb73
173 changed files with 228 additions and 5136 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
local: 7d05c76d1828bc80e578c9b77f0c57b0e1afafc2 local: 20a833eb75e92c3f7dd081bf526d8d8fbaf618ef
upstream: df7f8966862ae9268091bc84ebafc0b9a89706b0 upstream: 238e9855c35a3570f824b837826aac71e50722f4

View file

@ -4,5 +4,5 @@ Scroll anchoring adjusts the scroll position to prevent visible jumps (or
"reflows") when content changes above the viewport. "reflows") when content changes above the viewport.
* [explainer](https://github.com/WICG/ScrollAnchoring/blob/master/explainer.md) * [explainer](https://github.com/WICG/ScrollAnchoring/blob/master/explainer.md)
* [spec](https://wicg.github.io/ScrollAnchoring) * [spec](https://drafts.csswg.org/css-scroll-anchoring/)
* [file bug / view open issues](https://github.com/WICG/ScrollAnchoring/issues) * [file bug / view open issues](https://github.com/w3c/csswg-drafts/issues)

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :placeholder-shown matching on type change</title> <title>Check for correctly updating :placeholder-shown matching on type change</title>
<link rel="match" href="selector-placeholder-shown-type-change-001-ref.html"> <link rel="match" href="selector-placeholder-shown-type-change-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#placeholder">
<style> <style>
span { color: red; } span { color: red; }
:placeholder-shown + span { color: green } :placeholder-shown + span { color: green }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :placeholder-shown matching on type change</title> <title>Check for correctly updating :placeholder-shown matching on type change</title>
<link rel="match" href="selector-placeholder-shown-type-change-002-ref.html"> <link rel="match" href="selector-placeholder-shown-type-change-002-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#placeholder">
<style> <style>
span { color: green; } span { color: green; }
:placeholder-shown + span { color: red } :placeholder-shown + span { color: red }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :placeholder-shown matching on type change</title> <title>Check for correctly updating :placeholder-shown matching on type change</title>
<link rel="match" href="selector-placeholder-shown-type-change-003-ref.html"> <link rel="match" href="selector-placeholder-shown-type-change-003-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#placeholder">
<style> <style>
span { color: green; } span { color: green; }
:placeholder-shown + span { color: red } :placeholder-shown + span { color: red }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :read-write matching on type change</title> <title>Check for correctly updating :read-write matching on type change</title>
<link rel="match" href="selector-read-write-type-change-001-ref.html"> <link rel="match" href="selector-read-write-type-change-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#rw-pseudos">
<style> <style>
span { color: green; } span { color: green; }
:read-write + span { color: red } :read-write + span { color: red }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :read-write matching on type change</title> <title>Check for correctly updating :read-write matching on type change</title>
<link rel="match" href="selector-read-write-type-change-002-ref.html"> <link rel="match" href="selector-read-write-type-change-002-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#rw-pseudos">
<style> <style>
span { color: red; } span { color: red; }
:read-write + span { color: green } :read-write + span { color: green }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :required matching on type change</title> <title>Check for correctly updating :required matching on type change</title>
<link rel="match" href="selector-required-type-change-001-ref.html"> <link rel="match" href="selector-required-type-change-001-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#opt-pseudos">
<style> <style>
span { color: green; } span { color: green; }
:required + span { color: red } :required + span { color: red }

View file

@ -3,6 +3,7 @@
<head> <head>
<title>Check for correctly updating :required matching on type change</title> <title>Check for correctly updating :required matching on type change</title>
<link rel="match" href="selector-required-type-change-002-ref.html"> <link rel="match" href="selector-required-type-change-002-ref.html">
<link rel="help" href="https://drafts.csswg.org/selectors-4/#opt-pseudos">
<style> <style>
span { color: red; } span { color: red; }
:required + span { color: green } :required + span { color: green }

View file

@ -161,6 +161,11 @@ SET TIMEOUT: cookies/resources/testharness-helpers.js
SET TIMEOUT: common/reftest-wait.js SET TIMEOUT: common/reftest-wait.js
SET TIMEOUT: conformance-checkers/* SET TIMEOUT: conformance-checkers/*
SET TIMEOUT: content-security-policy/* SET TIMEOUT: content-security-policy/*
SET TIMEOUT: css/selectors4/selector-placeholder-shown-type-change-001.html
SET TIMEOUT: css/selectors4/selector-placeholder-shown-type-change-002.html
SET TIMEOUT: css/selectors4/selector-placeholder-shown-type-change-003.html
SET TIMEOUT: css/selectors4/selector-read-write-type-change-002.html
SET TIMEOUT: css/selectors4/selector-required-type-change-002.html
SET TIMEOUT: css-fonts/font-display/font-display.html SET TIMEOUT: css-fonts/font-display/font-display.html
SET TIMEOUT: encrypted-media/Google/migrated_to_root_disabled/encrypted-media-utils.js SET TIMEOUT: encrypted-media/Google/migrated_to_root_disabled/encrypted-media-utils.js
SET TIMEOUT: encrypted-media/polyfill/chrome-polyfill.js SET TIMEOUT: encrypted-media/polyfill/chrome-polyfill.js
@ -221,6 +226,7 @@ SET TIMEOUT: service-workers/service-worker/activation.https.html
SET TIMEOUT: service-workers/service-worker/fetch-frame-resource.https.html SET TIMEOUT: service-workers/service-worker/fetch-frame-resource.https.html
SET TIMEOUT: service-workers/service-worker/fetch-request-redirect.https.html SET TIMEOUT: service-workers/service-worker/fetch-request-redirect.https.html
SET TIMEOUT: service-workers/service-worker/fetch-waits-for-activate.https.html SET TIMEOUT: service-workers/service-worker/fetch-waits-for-activate.https.html
SET TIMEOUT: service-workers/service-worker/ready.https.html
SET TIMEOUT: service-workers/service-worker/update-recovery.https.html SET TIMEOUT: service-workers/service-worker/update-recovery.https.html
SET TIMEOUT: service-workers/service-worker/resources/extendable-event-async-waituntil.js SET TIMEOUT: service-workers/service-worker/resources/extendable-event-async-waituntil.js
SET TIMEOUT: service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js SET TIMEOUT: service-workers/service-worker/resources/fetch-event-async-respond-with-worker.js
@ -228,6 +234,7 @@ SET TIMEOUT: service-workers/service-worker/resources/fetch-event-test-worker.js
SET TIMEOUT: service-workers/service-worker/resources/opaque-response-being-preloaded-xhr.html SET TIMEOUT: service-workers/service-worker/resources/opaque-response-being-preloaded-xhr.html
SET TIMEOUT: service-workers/service-worker/resources/opaque-response-preloaded-xhr.html SET TIMEOUT: service-workers/service-worker/resources/opaque-response-preloaded-xhr.html
SET TIMEOUT: service-workers/service-worker/resources/performance-timeline-worker.js SET TIMEOUT: service-workers/service-worker/resources/performance-timeline-worker.js
SET TIMEOUT: service-workers/service-worker/resources/resource-timing-worker.js
SET TIMEOUT: service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js SET TIMEOUT: service-workers/service-worker/resources/register-foreign-fetch-errors-worker.js
SET TIMEOUT: shadow-dom/Document-prototype-currentScript.html SET TIMEOUT: shadow-dom/Document-prototype-currentScript.html
SET TIMEOUT: shadow-dom/scroll-to-the-fragment-in-shadow-tree.html SET TIMEOUT: shadow-dom/scroll-to-the-fragment-in-shadow-tree.html
@ -250,6 +257,9 @@ SET TIMEOUT: websockets/*
SET TIMEOUT: webstorage/eventTestHarness.js SET TIMEOUT: webstorage/eventTestHarness.js
SET TIMEOUT: webvtt/* SET TIMEOUT: webvtt/*
SET TIMEOUT: workers/* SET TIMEOUT: workers/*
SET TIMEOUT: XMLHttpRequest/abort-during-done.htm
SET TIMEOUT: XMLHttpRequest/abort-during-headers-received.htm
SET TIMEOUT: XMLHttpRequest/abort-during-loading.htm
SET TIMEOUT: XMLHttpRequest/open-url-multi-window-6.htm SET TIMEOUT: XMLHttpRequest/open-url-multi-window-6.htm
SET TIMEOUT: XMLHttpRequest/xmlhttprequest-timeout-reused.html SET TIMEOUT: XMLHttpRequest/xmlhttprequest-timeout-reused.html
SET TIMEOUT: XMLHttpRequest/resources/init.htm SET TIMEOUT: XMLHttpRequest/resources/init.htm

View file

@ -1,38 +0,0 @@
# W3C Browser Automation Specification Tests
This repository defines a set of conformance tests for the W3C web
browser automation specification known as WebDriver. The purpose is
for the different driver implementations to be tested to determine
whether they meet the recognized standard.
## How to run the tests
1. Go to the WebDriver tests: `cd _WEBDRIVER_TEST_ROOT_`
2. Run the tests: `python runtests.py`
3. Run the test against a different config specified in webdriver.cfg:
`WD_BROWSER=chrome python runtests.py`
To be run a specific test file you can just run `python test_file.py`
Similarly you can specify a different browser to run against if in webdriver.cfg:
`WD_BROWSER=chrome python ecmascript/ecmascript_test.py`
Note: that you will need likely need to start the driver's server before running.
## Updating configuration
The _webdriver.cfg_ file holds any configuration that the tests might
require. Change the value of browser to your needs. This will then
be picked up by WebDriverBaseTest when tests are run.
Be sure not to commit your _webdriver.cfg_ changes when your create or modify tests.
## How to write tests
1. Create a test file per section from the specification.
2. For each test there needs to be one or more corresponding HTML
files that will be used for testing. HTML files are not to be
reused between tests. HTML files and other support files
should be stored in a folder named 'res'.
3. Test name should explain the intention of the test e.g. `def
test_navigate_and_return_title(self):`

View file

@ -1,60 +0,0 @@
import ConfigParser
import json
import os
import sys
import unittest
from network import get_lan_ip
repo_root = os.path.abspath(os.path.join(__file__, "../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
sys.path.insert(1, os.path.join(repo_root, "tools", "wptserve"))
from wptserve import server
from selenium import webdriver
class WebDriverBaseTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.driver = create_driver()
cls.webserver = server.WebTestHttpd(host=get_lan_ip())
cls.webserver.start()
cls.webserver.where_is = cls.webserver.get_url
@classmethod
def tearDownClass(cls):
cls.webserver.stop()
if cls.driver:
cls.driver.quit()
def create_driver():
config = ConfigParser.ConfigParser()
config.read('webdriver.cfg')
section = os.environ.get("WD_BROWSER", 'firefox')
if config.has_option(section, 'url'):
url = config.get(section, "url")
else:
url = 'http://127.0.0.1:4444/wd/hub'
capabilities = None
if config.has_option(section, 'capabilities'):
try:
capabilities = json.loads(config.get(section, "capabilities"))
except:
pass
mode = 'compatibility'
if config.has_option(section, 'mode'):
mode = config.get(section, 'mode')
if section == 'firefox':
driver = webdriver.Firefox()
elif section == 'chrome':
driver = webdriver.Chrome()
elif section == 'edge':
driver = webdriver.Remote()
elif section == 'ie':
driver = webdriver.Ie()
elif section == 'selendroid':
driver = webdriver.Android()
return driver

View file

@ -1,64 +0,0 @@
import os
import sys
import random
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions
class OpenAndCloseWindowTest(base_test.WebDriverBaseTest):
def setUp(self):
self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html"))
def tearDown(self):
handles = self.driver.get_window_handles()
for i in range(len(handles) - 1):
self.driver.switch_to_window(handles[i])
self.driver.close()
self.driver.switch_to_window(self.driver.get_window_handles()[0])
def test_open_new_window(self):
handles = self.driver.get_window_handles()
self.driver.find_element_by_id("open_new_window").click()
self.assertEquals(len(handles) + 1, len(self.driver.get_window_handles()))
def test_get_window_handles_returns_the_windows_that_have_been_opened(self):
self.driver.find_element_by_id("open_new_window").click()
handles = self.driver.get_window_handles()
self.driver.switch_to_window(handles[0])
url1 = self.driver.get_current_url()
self.driver.switch_to_window(handles[1])
url2 = self.driver.get_current_url()
if url1 == self.webserver.where_is("controlling_windows/res/other-page.html"):
self.assertEquals(url2, self.webserver.where_is("controlling_windows/res/first-page.html"))
elif url1 == self.webserver.where_is("controlling_windows/res/first-page.html"):
self.assertEquals(url2, self.webserver.where_is("controlling_windows/res/other-page.html"))
else:
self.fail("The wrong set of URLs were returned")
def test_close_window(self):
open_windows = len(self.driver.get_window_handles())
self.driver.find_element_by_id("open_new_window").click()
self.assertEquals(1 + open_windows, len(self.driver.get_window_handles()))
self.driver.close()
self.assertEquals(open_windows, len(self.driver.get_window_handles()))
def test_command_sent_to_closed_window_returns_no_such_window_exception(self):
self.driver.find_element_by_id("open_new_window").click()
self.driver.close()
with self.assertRaises(exceptions.NoSuchWindowException):
self.driver.get_window_handle()
if __name__ == "__main__":
unittest.main()

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>First Page</title>
</head>
<body>
<a href="./other-page.html" target="_blank" id="open_new_window">Open new window</a>
</body>
</html>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Other Page</title>
</head>
<body>
<a href="./other-page.html" target="_blank" id="open_new_window">Open new window</a>
</body>
</html>

View file

@ -1,33 +0,0 @@
import os
import sys
import random
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions
class WindowHandleTest(base_test.WebDriverBaseTest):
def setUp(self):
self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html"))
def test_window_handle_is_not_current(self):
handle = self.driver.get_window_handle()
self.assertNotEquals(handle, "current")
def test_window_handles_are_unique(self):
number_of_windows = 20
new_window_button = self.driver.find_element_by_id("open_new_window")
for i in range(0, number_of_windows):
new_window_button.click()
handles = self.driver.get_window_handles()
if len(handles) > len(set(handles)):
self.fail('At least one window handle was repeated')
if __name__ == "__main__":
unittest.main()

View file

@ -1,35 +0,0 @@
import os
import sys
import random
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions
class WindowSizeTest(base_test.WebDriverBaseTest):
def test_set_and_get_window_size(self):
self.driver.get(self.webserver.where_is("command_contexts/res/first-page.html"))
initial_dimensions = self.driver.get_window_size()
new_dimensions = {
"height": initial_dimensions["height"] - 100,
"width": initial_dimensions["width"] - 100}
try:
self.driver.set_window_size(new_dimensions["height"], new_dimensions["width"])
actual_dimensions = self.driver.get_window_size()
self.assertDictEqual(new_dimensions, actual_dimensions)
except exceptions.UnsupportedOperationException:
pass
if __name__ == "__main__":
unittest.main()

View file

@ -1,57 +0,0 @@
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
from selenium.common import exceptions
class CookieTest(base_test.WebDriverBaseTest):
def setUp(self):
self.driver.get(self.webserver.where_is("cookie/res/cookie_container.html"))
def test_can_create_a_well_formed_cookie( self ):
self.driver.add_cookie({'name': 'foo', 'value': 'bar'})
def test_cookies_should_allow_secure_to_be_set( self ):
name = 'foo'
self.driver.add_cookie({'name': name,
'value': 'bar',
'path': '/',
'secure': (True)})
self.assertTrue(self.driver.get_cookie(name)[0]['secure'])
def test_secure_defaults_to_false( self ):
name = 'foo'
value = 'bar'
self.driver.add_cookie({ 'name': name,
'value': value})
self.assertFalse(self.driver.get_cookie(name)[0]['secure'])
def test_should_throw_an_exception_when_semicolon_exists_in_the_cookie_attribute(self):
invalid_name = 'foo;bar'
try:
self.driver.add_cookie({'name': invalid_name, 'value': 'foobar'})
self.fail( 'should have thrown exceptions.' )
except exceptions.UnableToSetCookieException:
pass
except exceptions.InvalidCookieDomainException:
pass
def test_should_throw_an_exception_the_name_is_null(self):
try:
self.driver.add_cookie({'name': None, 'value': 'foobar'})
self.fail( 'should have thrown exceptions.' )
except exceptions.UnableToSetCookieException:
pass
except exceptions.InvalidCookieDomainException:
pass
if __name__ == '__main__':
unittest.main()

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Cookie Container</title>
<body>
</body>

View file

@ -1,17 +0,0 @@
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class EcmasScriptTest(base_test.WebDriverBaseTest):
def test_that_ecmascript_returns_document_title(self):
self.driver.get(self.webserver.where_is("ecmascript/res/ecmascript_test.html"))
result = self.driver.execute_script("return document.title;");
self.assertEquals("ecmascript test", result);
if __name__ == "__main__":
unittest.main()

View file

@ -1,2 +0,0 @@
<!DOCTYPE html>
<title>ecmascript test</title>

View file

@ -1,60 +0,0 @@
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class ElementLocationTest(base_test.WebDriverBaseTest):
def test_find_element_by_name(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_element_by_name("name")
self.assertEquals("name", e.text)
def test_find_element_by_css_selector(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_element_by_css_selector("#id")
self.assertEquals("id", e.text)
def test_find_element_by_link_text(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_element_by_link_text("link text")
self.assertEquals("link text", e.text)
def test_find_element_by_partial_link_text(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_element_by_partial_link_text("link tex")
self.assertEquals("link text", e.text)
def test_find_element_by_xpath(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_element_by_xpath("//*[@id='id']")
self.assertEquals("id", e.text)
def test_find_elements_by_name(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_elements_by_name("name")
self.assertEquals("name", e[0].text)
def test_find_elements_by_css_selector(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_elements_by_css_selector("#id")
self.assertEquals("id", e[0].text)
def test_find_elements_by_link_text(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_elements_by_link_text("link text")
self.assertEquals("link text", e[0].text)
def test_find_elements_by_partial_link_text(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_elements_by_partial_link_text("link tex")
self.assertEquals("link text", e[0].text)
def test_find_elements_by_xpath(self):
self.driver.get(self.webserver.where_is("element_location/res/elements.html"))
e = self.driver.find_elements_by_xpath("//*[@id='id']")
self.assertEquals("id", e[0].text)
if __name__ == "__main__":
unittest.main()

View file

@ -1,10 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Element location</title>
<body>
<div id="id">id</div>
<div id="name" name="name">name</div>
<a id="link">link text</a>
</body>

View file

@ -1,107 +0,0 @@
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class GetElementAttributeTest(base_test.WebDriverBaseTest):
def test_get_element_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/element-with-id-attribute.html"))
el = self.driver.find_element_by_css_selector("div")
self.assertEqual("myId", el.get_attribute("id"))
def test_style_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/element-with-style-attribute.html"))
el = self.driver.find_element_by_css_selector("div")
expected_style = """
font-family: \"Gill Sans Extrabold\",Helvetica,sans-serif;
line-height: 1.2; font-weight: bold;
"""
self.assertEqual(expected_style, el.get_attribute("style"))
def test_color_serialization_of_style_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/element-with-color-style-attribute.html"))
el = self.driver.find_element_by_css_selector("div")
self.assertEqual("color: rgba(255, 0, 0, 1.0);", el.get_attribute("style"))
def test_true_if_boolean_attribute_present(self):
self.driver.get(self.webserver.where_is("element_state/res/input-with-checked-attribute.html"))
el = self.driver.find_element_by_css_selector("input")
self.assertEqual("true", el.get_attribute("checked"))
def test_none_if_boolean_attribute_absent(self):
self.driver.get(self.webserver.where_is("element_state/res/input-without-checked-attribute.html"))
el = self.driver.find_element_by_css_selector("input")
self.assertIsNone(el.get_attribute("checked"))
def test_option_with_attribute_value(self):
self.driver.get(self.webserver.where_is("element_state/res/option-with-value-attribute.html"))
el = self.driver.find_element_by_css_selector("option")
self.assertEqual("value1", el.get_attribute("value"))
def test_option_without_value_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/option-without-value-attribute.html"))
el = self.driver.find_element_by_css_selector("option")
self.assertEqual("Value 1", el.get_attribute("value"))
def test_a_href_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/a-with-href-attribute.html"))
el = self.driver.find_element_by_css_selector("a")
self.assertEqual("http://web-platform.test:8000/path#fragment", el.get_attribute("href"))
def test_img_src_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/img-with-src-attribute.html"))
el = self.driver.find_element_by_css_selector("img")
self.assertEqual("http://web-platform.test:8000/images/blue.png", el.get_attribute("src"))
def test_custom_attribute(self):
self.driver.get(self.webserver.where_is("element_state/res/element-with-custom-attribute.html"))
el = self.driver.find_element_by_css_selector("div")
self.assertEqual("attribute value", el.get_attribute("webdriver-custom-attribute"))
def test_attribute_not_present(self):
self.driver.get(self.webserver.where_is("element_state/res/element-without-attribute.html"))
el = self.driver.find_element_by_css_selector("div")
self.assertIsNone(el.get_attribute("class"))
def test_find_attribute_with_special_characters(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_special_char_attribute_name")
attribute = element.get_attribute("*")
self.assertEquals("special_char_attribute_name", attribute)
def test_find_attribute_with_special_char_name_and_value(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_special_char_attribute_name_and_value")
attribute = element.get_attribute("@")
self.assertEquals("(", attribute)
def test_find_attribute_with_numeric_name(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_attribute_name_numeric")
attribute = element.get_attribute("1")
self.assertEquals("numeric attribute name", attribute)
def test_find_attribute_with_numeric_value(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_attribute_value_numeric")
attribute = element.get_attribute("one")
self.assertEquals("2", attribute)
def test_find_attribute_with_negative_numeric_name(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_attribute_negative_numeric_name")
attribute = element.get_attribute("-5")
self.assertEquals("attribute name is -5", attribute)
def test_find_attribute_with_negative_numeric_value(self):
self.driver.get(self.webserver.where_is("element_state/res/get-element-attribute-extended.html"))
element = self.driver.find_element_by_id("id_attribute_negative_numeric_value")
attribute = element.get_attribute("negative_numeric_value")
self.assertEquals("-9", attribute)
if __name__ == "__main__":
unittest.main()

View file

@ -1,17 +0,0 @@
import os
import sys
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
class GetElementPropertiesTest(base_test.WebDriverBaseTest):
def test_get_element_text(self):
self.driver.get(self.webserver.where_is("element_state/res/elements_text.html"))
e = self.driver.find_element_by_name("name")
self.assertEquals("name", e.text)
if __name__ == "__main__":
unittest.main()

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>0x0 pixel element</title>
<style>
div {
height: 0;
width: 0;
}
</style>
<div>This element is not visible.</div>

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>1x1 pixel element</title>
<style>
p {
height: 1px;
width: 1px;
}
</style>
<p>This element is visible.</p>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>"a" element with not fully qualified url</title>
<a href="//web-platform.test:8000/path#fragment">&nbsp;</a>

View file

@ -1,16 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Parent node visible with absolutely positioned children, where ancestor overflow is hidden</title>
<style>
body {
overflow: hidden;
height: 0;
width: 0;
}
.child { position: absolute }
</style>
<div id=parent>
<div class=child>grated</div>
<div class=child>cheese</div>

View file

@ -1,4 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>BODY element has no children. MUST be reported displayed</title>
<body/>

View file

@ -1,3 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>BODY tag is omitted; BODY element MUST be reported displayed</title>

View file

@ -1,4 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>BODY element with style=overflow:hidden. MUST be reported displayed</title>
<body style="overflow:hidden"/>

View file

@ -1,4 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>BODY element with style=visibility:hidden. MUST be reported displayed</title>
<body style="visibility:hidden"/>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>display: block;</title>
<p>This element is visible.</p>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: none applies to child node links</title>
<style>
#parent { display: none }
</style>
<div id="parent">
<a id="child">hidden</a>
</div>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: none applies to child node paragraphs</title>
<style>
#parent { display: none }
</style>
<div id="parent">
<p id="child">hidden</p>
</div>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>display: none applies to child nodes</title>
<style>
#parent { display: none }
</style>
<div id="parent">
<div id="child">Brie is good</div>
</div>

View file

@ -1,10 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>display: none set dynamically</title>
<p id="hidden">Should not be visible</span>
<script>
var hidden = document.getElementById("hidden");
hidden.style.display = "none";
</script>

View file

@ -1,15 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>display: none on parent takes presedence over visibility: visible on child node</title>
<style>
#parent { display: none }
#child { visibility: visible }
</style>
<div id="parent">
<div id="child">
hidden
</div>
</div>
in

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>display: none on parent takes presedence</title>
<style>
#parent { display: none }
#child { dipslay: block }
</style>
<div id="parent">
<div id="child">
hidden
</div>
</div>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset='utf-8'>
<title>display: none;</title>
<style>
p {
display: none;
}
</style>
<p>This element is not visible.</p>

View file

@ -1,15 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element outside viewport</title>
<style>
div { position: absolute }
</style>
<div>hidden</div>
<script>
var el = document.getElementsByTagName("div")[0];
el.style.top = "-500px";
el.style.left = "-500px";
</script>

View file

@ -1,20 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element hidden by other element</title>
<style>
div {
position: absolute;
height: 100px;
width: 100px;
}
#overlay {
background: blue;
}
#hidden { background: red }
</style>
<div id="hidden"></div>
<div id="overlay"></div>

View file

@ -1,29 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element hidden by z-index</title>
<style>
* { position: relative }
#overlay,
#hidden {
height: 50px;
width: 50px;
}
#overlay {
background: blue;
z-index: 1;
}
#hidden {
background: red;
top: -50px;
z-index: -1;
}
</style>
<div id="overlay"></div>
<div id="hidden"></div>

View file

@ -1,31 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element moved behind other element by transform</title>
<style>
* { position: relative }
#overlay {
height: 50px;
width: 50px;
background: blue;
z-index: 1;
}
#hidden {
height: 50px;
width: 50px;
background: red;
z-index: -1;
transform: translate(0, -50px);
/* fix your browsers god damnit */
-webkit-transform: translate(0, -50px);
-moz-transform: translate(0x, -50px);
}
</style>
<div id="overlay"></div>
<div id="hidden"></div>

View file

@ -1,15 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element moved outside viewpor by transform</title>
<style>
div {
transform: translate(-200px, -200px);
/* fix your browsers god damnit */
-webkit-transform: translate(-200px, -200px);
-moz-transform: translate(-200px, -200px);
}
</style>
<div>Cheddar!</div>

View file

@ -1,13 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element outside viewport</title>
<style>
div {
position: absolute;
top: -500px;
left: -500px;
}
</style>
<div>hidden</div>

View file

@ -1,23 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element partially hidden by other element</title>
<style>
div {
height: 100px;
width: 100px;
}
#partial {
background: yellow;
}
#other {
background: blue;
margin-top: -50px;
margin-left: 50px;
}
</style>
<div id="partial"></div>
<div id="other"></div>

View file

@ -1,89 +0,0 @@
<html>
<body>
<select>
<option id="selected-1">selected-1</option>
</select>
<select>
<option id="selected-2">selected-2</option>
<option id="unselected-1">unselected-1</option>
</select>
<select disabled>
<option id="unselected-2">unselected-2</option>
<option id="selected-3" selected>selected-3</option>
<option id="unselected-3">unselected-3</option>
</select>
<select>
<option id="unselected-4" checked>unselected-4</option>
<option id="unselected-5">unselected-5</option>
<option id="selected-4" selected>selected-4</option>
</select>
<select>
<option id="unselected-6" selected>unselected-6</option>
<option id="selected-5">selected-5</option>
</select>
<script>
document.getElementById("selected-5").selected = true;
</script>
<select multiple>
<option id="unselected-7">unselected-7</option>
<option id="unselected-8">unselected-8</option>
</select>
<select multiple>
<option id="selected-6" selected>selected-6</option>
<option id="unselected-9" selected>unselected-9</option>
<option id="selected-7">selected-7</option>
</select>
<script>
document.getElementById("unselected-9").selected = false;
document.getElementById("selected-7").selected = true;
</script>
<h1>Input Checkbox Elements</h1>
<input type="checkbox" id="selected-8" />selected-8
<script>
document.getElementById("selected-8").checked = true;
</script>
<input type="checkbox" id="selected-9" checked />selected-9
<script>
document.getElementById("selected-9").indeterminate = true;
</script>
<input type="checkbox" id="unselected-10" />unselected-10
<input type="checkbox" id="unselected-11" checked />unselected-11
<script>
document.getElementById("unselected-11").checked = false;
</script>
<input type="checkbox" id="unselected-12" />unselected-12
<script>
document.getElementById("unselected-12").indeterminate = true;
</script>
<input type="checkbox" id="unselected-13" selected />unselected-13
<input type="checkbox" id="selected-10" checked />selected-10
<h1>Input Radio Elements</h1>
<br>Group 1:<br>
<input type="radio" name="group1" id="selected-11" checked />selected-11
<br>Group 2:<br>
<input type="radio" name="group2" id="selected-12" />selected-12
<script>
document.getElementById("selected-12").checked = true;
</script>
<br>Group 3:<br>
<input type="radio" name="group3" id="unselected-14" />unselected-14
<input type="radio" name="group3" id="selected-13" checked />selected-13
<br>Group 4:<br>
<input type="radio" name="group4" id="unselected-15" checked />unselected-15
<input type="radio" name="group4" id="selected-14" checked />selected-14
<br>Group 5:<br>
<input type="radio" name="group5" id="unselected-16" />unselected-16
<input type="radio" name="group5" id="unselected-17" checked />unselected-17
<script>
document.getElementById("unselected-17").checked = false;
</script>
<br>Group 6<br>
<input type="radio" name="group6" id="selected-15" />selected-15
<input type="radio" name="group6" id="unselected-18" checked />unselected-18
<script>
document.getElementById("selected-15").checked = true;
</script>
</body>
</html>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with color style attribute</title>
<div style="color: red">&nbsp;</div>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with custom attribute</title>
<div webdriver-custom-attribute="attribute value">&nbsp;</div>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with id attribute</title>
<div id="myId">&nbsp;</div>

View file

@ -1,10 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with same color as background</title>
<style>
body, div { background: white }
div { width: 50px; height: 50px; }
</style>
<div>&nbsp;</div>

View file

@ -1,18 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with same color as background</title>
<style>
#overlay,
#hidden {
background: blue;
width: 50px; height: 50px;
}
#hidden {
margin-top: -50px;
}
</style>
<div id="overlay"></div>
<div id="hidden"></div>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element with style attribute</title>
<div style='font-family: "Gill Sans Extrabold", Helvetica, sans-serif; line-height: 1.2; font-weight:bold'>&nbsp;</div>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Element without attribute</title>
<div>&nbsp;</div>

View file

@ -1,10 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>Element location</title>
<body>
<div id="id">id</div>
<div id="name" name="name">name</div>
<a id="link">link text</a>
</body>

View file

@ -1,72 +0,0 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Get Element Attribute Extended</title>
<span id=my_id_with_a_relatively_long_name_test class=my_id_with_a_relatively_long_name_test_class>Span</span>
<span id=my-id>Span</span>
<div class=container>
<div id=div1 name=div-name>
<div id=div1-1_div1>
<h1 id=h1_div1.1_div1 class=span-class>h1 element, id:h1_div1.1_div1</h1>
</div>
</div>
<div class=div-depth-2>
<div class=div-depth-3>
<div class=div-depth-4>
<span id=my_id_with_a_relatively_long_name_test class=my_id_with_a_relatively_long_name_test_class>Span</span>
</div>
</div>
</div>
<div>
<a>anchor text 123</a>
<a>anchor text 123</a>
<select>
<option id="opt-1" style="font-size: 11px; display: block;" selected>My Option 1</option>
<option class="opt" >My Option 2</option>
<option value="one">My Option 3</option>
</select>
</div>
<a id="no-vi-1" class="cant-see" style="display:none">no visibility</a><br/>
<a id="no-vi-2" style="display:none">no visibility</a><br/>
<a id="no-vi-2" style="display:none">no visibility</a><br/>
<span id=my_id_with_a_relatively_long_name_test2>Span</span>
<span id="id.period">Span</span>
</div>
<div id=id_attribute_accesskey accesskey=nothing></div>
<!-- Multiple elements with same class -->
<div id=id_div_multiple_elements_same_class_nested_depth_0 class=multiple_elements_same_class_nested>
<div id=id_multiple_elements_same_class_nested_div_depth_1 class=multiple_elements_same_class_nested>
<div id=id_multiple_elements_same_class_nested_div_depth_2 class=multiple_elements_same_class_nested>
</div>
</div>
</div>
<!-- Attribute name with special characters -->
<div id=id_special_char_attribute_name *=special_char_attribute_name></div>
<!-- Attribute value with special characters -->
<div id=id_special_char_attribute_value name="*"></div>
<!-- Attribute value and name with special characters -->
<div id=id_special_char_attribute_name_and_value @="("></div>
<!-- Attribute name is numeric. -->
<div id"id_attribute_name_numeric 1="numeric attribute name"></div>
<!-- Attribute value is numeric. -->
<div id=id_attribute_value_numeric one=2></div>
<!-- Attribute name is negative numeric. -->
<div id=id_attribute_negative_numeric_name -5="attribute name is -5"></div>
<!-- Attribute value is negative numeric. -->
<div id=id_attribute_negative_numeric_value negative_numeric_value=-9></div>

View file

@ -1,9 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Hidden INPUT @type="checkbox" is untogglable</title>
<style>
input { display: none }
</style>
<input type="checkbox" />

View file

@ -1,9 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Typing in hidden input is impossible</title>
<style>
input { display: none }
</style>
<input type="text" />

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<div id='singleHidden' hidden>This will not be visible</div>
<div id='parent' hidden>
<div id='child'>My parent is hidden so you can't see me</div>
</div>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>"img" element with not fully qualified url</title>
<img src="//web-platform.test:8000/images/blue.png">&nbsp;</a>

View file

@ -1,10 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>INPUT motphs into @type="hidden"</title>
<input />
<script>
var input = document.getElementsByTagName("input")[0];
input.type = "hidden";
</script>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>INPUT @type="hidden" is unclickable</title>
<input type="hidden" />

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>INPUT @type="hidden" are always hidden</title>
<input type="hidden" />

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Input with checked attribute</title>
<input type=checkbox checked="false">&nbsp;</input>

View file

@ -1,5 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Input without checked attribute</title>
<input type=checkbox>&nbsp;</input>

View file

@ -1,7 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Option with value attribute</title>
<select>
<option value="value1">Value 1</option>
</select>

View file

@ -1,7 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Option without value attribute</title>
<select>
<option>Value 1</option>
</select>

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Text with matching color and background</title>
<style>
p {
background: blue;
color: blue;
}
</style>
<p>
This on the other hand, should be visible
</p>

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Text with same color as background</title>
<style>
body { background: white }
p { color: white }
</style>
<p>
Shouldn't be visible.
</p>

View file

@ -1,14 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Text with same color as parent background</title>
<style>
#parent { background: gray }
p { color: gray }
</style>
<div id="parent">
<p>
Should not be visible
</p>
</div>g

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>visibility: hidden applies to child node of type A</title>
<style>
#parent { visibility: hidden }
</style>
<div id="parent">
<a id="child" href="#">Brie is good</a>
</div>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>visibility: hidden applies to child nodes of type P</title>
<style>
#parent { visibility: hidden }
</style>
<div id="parent">
<p id="child">Brie is good</p>
</div>

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8">
<title>visibility: visible on child node takes presedence</title>
<style>
#parent { visibility: hidden }
#child { visibility: visible }
</style>
<div id="parent">
<div id="child">Brie is good</div>
</div>

View file

@ -1,11 +0,0 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>visibility: hidden applies to child nodes</title>
<style>
#parent { visibility: hidden }
</style>
<div id="parent">
<div id="child">Brie is good</div>
</div>

Some files were not shown because too many files have changed in this diff Show more