Cascading Style Sheets (CSS) is a simple mechanism for adding style (e.g., fonts, colors, spacing) to Web documents.

learn more… | top users | synonyms

16
votes
3answers
50k views

A way to match on text using CSS locators

So I use xpath locators and slowly converting to CSS. I haven't found a way to do an exact match based on text. For example converting //a[text()='Log Out']. I know you can do css=a:contains('Log ...
9
votes
5answers
931 views

Is there any reliable way to write unit test against the CSS itself for a site?

is that a feasible idea? what tools do you use? what do you call this kind of testing?
4
votes
2answers
13k views

Selenium - Find exact text match using CSS locators

According to A way to match on text using CSS locators, we should be able to use "^$" to find exact text match using CSS locators. But with div class="item"><div ...
2
votes
3answers
108 views

Correct CSS selector for selenium

Which css selector's correct for the following HTML code ? <li class="active editing" data-index="0"> <div class="view"> <input class="edit"/> </li> I'm trying to get ...
2
votes
1answer
310 views

How do I test that external CSS does not contain an absolute URL via unit test?

I have been given the task of validating that we do not have any http:// URLs in our CSS or HTML documents. I've created a selenium IDE test that looks at src & href attributes as well as script ...
2
votes
2answers
88 views

CSS visual regression - do I need to store screenshots in git repository?

There is a technique to check if something visually not broken in HTML and CSS markup - visual regression testing. We do following steps: Check everything is ok. Create a test "reference" (creating ...
1
vote
3answers
74 views

How to generate good locators for elements in Web pages?

This site contains many questions that are about finding the right locator expression (XPath, CSS, etc) for an object in WebPage or about troubleshooting problems related in invalid or dynamic ...
1
vote
1answer
527 views

Selenium: Click on input-field with complicated selector

I need the right direction to click on a input field. When I copy the CSS path I get the following: html body#root div#box div#content div#C_INTERNAL_OBJECT-98286949812.container ...
1
vote
1answer
35 views

What are the debug tools that i can use for GUI Automation on Internet Explorer?

Are there any tools similar to firebug/firepath that i can use to test the locators on the internet explorer browser? I was running an xpath which works in firefox but fails in IE.
1
vote
1answer
25 views

Can Css Selector be used to write customized path using tag name traversing?

I wrote a xpath for the following using tag name traversing This is the xpath I wrote - .//form[@class = 'form-horizontal']/div[3]/div/input and it works fine but when I tried to write this in ...
1
vote
1answer
474 views

Dynamic ID selecting text from dropdown

I have a situation I'm trying to handle. I am using webdriver, C#. The image above is the dropdown I want to select from. This is how it works, to select from the element, first click it and a text ...
1
vote
2answers
67 views

CSS locator for body text between span tags in selenium

How do I build a CSS locator for the "Add Photos/Video" text between the span tags. I need to perform a click event on this element.
1
vote
0answers
44 views

Select a dropdown element with dynamic ID using Webdriver, C# [duplicate]

I have a situation I'm trying to handle. I am using webdriver, C#. when I tried using the CSSSelector it is just reading the parameter as a string. Kindly look into it.This is the HTML. <div ...
0
votes
1answer
65 views

Finding column with certain text works using xpath but fails with cssSelector

I was trying to locate table column containing text 'Name', and it fails while using cssSelector with 'Unable to locate element' but works with xpath. I tried all the 3 below options with different ...
0
votes
0answers
4 views

How to locate Facebook POST button using Java selenium web driver?

Code: driver.findelement(By.xpath(".//*[@id='js_2y']/div[4]/div[2]/div/div[2]/div/button")).click(); Every time I try by locating xpath, it's gives an exception, could not locate element. May 04, ...
0
votes
2answers
361 views

Selenium Webdriver - finding element on IE 11

I'm trying to assert a 'name' on my page, to assure the right name is displayed: public static OpenQA.Selenium.By Name = (By.CssSelector("p")); Assert.AreEqual("Name", ...