Aria labelledby is not valid - 508 compliance - accessibility

I'm receiving this error from the 508 compliance
The 'id' "authorizationsFiltersMember" specified for the WAI-ARIA property 'aria-labelledby' value is not valid
I've tried with authorizations filters member authorizations_filters_member and none of these works ?
How should I call it ?

All it is telling you is that you have either:
self referenced (i.e. <p id="authorizationsFiltersMember" aria-labelledby="authorizationsFiltersMember">) for example. Something can't be labelled by itself.
or that you have a typo in the element you are referencing (or you don't have an element with that ID at all).
or that the element you are referencing cannot be used as a label (i.e. if you gave it or it has a role that is an interactive element etc.)
Most likely is that you have a typo in the ID so try copy and pasting it again (ensure there are no spaces before and after it), it is a perfectly valid ID in terms of length and format.
As a side note: "authorizations filters member" would actually try and reference 3 elements with the IDs "authorizations", "filters" and "member" and combine them in that order to create the label for the element.

Related

Trying to search through text on a website in PlayWright API

The text I'm searching for is all contained within a CSS class called "content-center", and within that is a series of CSS classes all with the same name that old similar, but different information. It seems to only be returning [<JSHandle preview=JSHandle#node>] rather than returning the text itself as if saying "yes, this text is on the page X times".
page.wait_for_selector('.content-center')
print(page.query_selector_all(".content-center:has-text('Bob Johnson')"))
page.query_selector_all returns the ElementHandle[] values of the elements which got found. Over these you can loop and call the text_content() method to get the text out of that specific element.
Also in most cases, its enough to use the text-selectors to verify something is on the page or an element has text, see here for reference.

Is "--" a valid CSS3 identifier?

According the CSS Level 3 specification, for parsing the start of an identifier, you:
Check if three code points would start an identifier
Look at the first code point:
If the first character is -, then we have a valid identifier if:
The second code point is an identifier-start code point ([a-zA-Z_] or non-ASCII).
The second code point is -.
The second and third character form a valid escape.
Otherwise, we do not have a valid identifier start. After determining if we have a valid identifier start, the only requirements to have a valid <ident-token> is we have 0 or more of any combination of the following:
Escape tokens
ASCII letters
Digits
_ or -
Non-ASCII characters
Since we do not require any characters following an identifier start token, this would suggest that -- is a valid identifier, even if never supported by any browser or framework. However, even official CSS validation services (maintained by those that design the CSS specifications) do not consider this a valid identifier. Is this merely a bug in the validation service?
Yes it's valid and it works. It's the shortest custom property (aka CSS variable) that you can define:
body {
--:red;
background:var(--);
}
Related: Can a css variable name start with a number?
The -- custom property identifier is reserved for future use, but current browsers incorrectly treat it as a valid custom property.
See also
w3c/csswg-drafts#6313

How to verify a text is present on a webpage for 'n' times

I wanted to verify a text in a webpage exist for 2 times or ‘n’ times. I have used “Page Should Contain” keyword but it says “Pass” when it identifies single occurrence. I don’t want to verify using locator.
Ex: I want to verify the text "Success" is available in a current webpage for 3 times using robot framework
Any inputs/suggesstions would be helpful.
Too bad you don't want to use a locator, as robotframework has a keyword just for that:
Xpath Should Match X Times //*[contains(., "Success")] 2
The caveat is the locator should not be prepended with xpath= - just straight expression.
The library keyword Page Should Contain does pretty much exactly that, by the way.
And if you want to find how many times the string is present in the page - easy:
${count}= Get Matching Xpath Count //*[contains(., "Success")]
And then do any kind of checks on the result, e.g.
Should Be Equal ${count} 2
I thought the problem of not using locator sounds fun (the rationale behind the requirement still unclear, yet), so another solution - look in the source yourself:
${source}= Page Source # you have the whole html of the page here
${matches}= Get Regexp Matches ${source} >.*\b(Success)\b.*<
${count}= Get Length ${matches}
The first one gets the source, the second gets all non-overlapping (separate) occurrences of the target string, when it is (hopefully) inside a tag. The third line returns the count.
Disclaimer - please don't actually do that, unless you're 100% sure of the source and the structure. Use a locator.

AtomPub multipart, more than one Media Part?

In draft-gregorio-atompub-multipart-04.txt chapter 3, third paragraph it says :
A multipart/related POST to a Media Collection MUST be a valid
multipart/related representation as defined by [RFC2387] and MUST
contain two body parts. One, referred to as the Entry Part, MUST be
an Atom Entry with a media type of 'application/atom+xml' or
'application/atom+xml;type=entry'. The other, referred to as the
Media Part, MUST be of a media type acceptable to the collection.
The object root MUST be the Entry Part. The Entry Part's atom:
content element MUST have a 'src' attribute whose value is the URI of
the related media in the Media Part. The 'src' attribute value MUST
be a 'cid:' URI as defined by [RFC2392]. The Content-Type: header of
the POST request MUST specify "application/atom+xml;type=entry" or
"application/atom+xml".
The question is, what does "MUST containt two body parts" mean? Does it mean that it must contain at least one Media Part, or that it must contain one, and only one, Media Part?
It means it must contain one Media Part and one Entry Part making two body parts in total.

spring form error tag: check for specific error (only display invalid if the not null is not present for example)

So I have a String I need to check for a valid format for which I used a pattern, and whether the entered value is valid according to some business rules for which I used a custom validator. Now the customer would prefer it if the error message associated with the latter is only shown if the former didn't occur. But as far as I know there is no way to make this distinction.
Or can anyone think of a way to do this?
The trick is: have two different constraints (annotations),
one for the pattern, that accept null,
and a second for not null.
By default the javax.validation.constraints.Pattern "validator" accept null.
Accepts String. null elements are considered valid.
(javax.validation.constraints.Pattern javadoc)
So what you need to do in the end is this:
#NotNull(message="{validation.notNull}")
#Pattern(pattern="123" message="{validation.notPattern}")
String myString;
Added:
(Comment)
Not really the desired behaviour since I want to reuse the bean object but the conditions aren't the same for each page. – Jack Nickels 5 mins ago
In this case you can use the so called groups (See JSR303 Bean Validation Spec, Chapter 4.1.2 groups -- there is also an example). Use the default Group for #Pattern and an other group for #NotNull. Now you can enable or disable the Validation rules according the groups you specify for validation.
validator.validate(myObject, Default.class);
validator.validate(myObject, MyGroup.class);
There is one problem left: in Spring 3.0 you can not Specify the Group you want to use for the automatic validation process. But in 3.1 you can, according to that Feature Request SPR-6373 (I have not tryed it, but I hope it works)

Resources