I would like to set up tests for a web site created with a page designer tool. I have some, but by no means complete, control over where attributes appear in a page. In particular, I would like a test to find an element with a certain id; check that the text of that element is correct; and check that the link for that element is correct. I want to log the result of each test—test passed or test failed.
My issue is as follows. I am able to use the storeText command to get the displayed text for a given id (in the above case, id=“syllabus”). However, the storeAttribute command is unable to find the href associated with that id. Unlike the storeText command, which apparently looks at all the embedded tags to find text, storeAttribute apparently does not look far enough to find the href. So, my question is how to find the href value in the above example and store it in a variable.
Thanks very much for that. I understand how this suggestion will work, but only if it is unique on the page. As it turns out, I have three such elements, each of which I want to test:
This is why I tried to get a unique id involved in the detection. It would be perfect if my page designer allowed me to add an id attribute to the <a> tag. Unfortunately, I cannot.
Thanks very, very much. That snippet does what I need. It’s a much more labor intensive approach than one depending on unique ids. A change to the page could potentially require the test to be rewritten.