Questions tagged [css]

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

Filter by
Sorted by
Tagged with
35 votes
6 answers
355k 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 ...
Brian O'Neill's user avatar
33 votes
7 answers
22k views

What makes a good selenium locator?

When automating UI tests with Selenium, it is often not absolutely clear what method and what locator to use to locate an element. Some locators are less reliable, less readable than others. And, ...
alecxe's user avatar
  • 11.4k
13 votes
7 answers
2k 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?
6 votes
2 answers
626 views

Testing CSS styles and design elements of website

How to find the CSS attributes for website. For eg: I have a testcase where I need to test the styling and design of a Button for webpage. How can I retrieve the elements, if for example I need find ...
WiredTheories's user avatar
3 votes
1 answer
841 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 ...
Lucas Holt's user avatar
3 votes
1 answer
4k views

How do I identify a specific <div> by id with Selenium?

I want to grab everything within this div with an id of "storytext": <!-- END ID="STORY-META" CLASS="STORY-META" --> <div id="storytext" class="storytext storylocation linkLocation"> ...
Thufir's user avatar
  • 367
3 votes
2 answers
235 views

A testing tool that determines whether a section of HTML matches a certain style?

This may be a long shot, but suppose I have a requirement that a given section of a web page be bolded. That could be done with <b> or <strong> tags, or even a heading tag assuming that ...
Jordan Reiter's user avatar
3 votes
2 answers
321 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 *...
Dmitry  Yaremenko's user avatar
2 votes
2 answers
7k views

Can't find any element using CSS selector with Selenium on Python

I'm running a script on vodafone.co.uk, but I can't find any element using the CSS Selector. browser.get("http://freesim.vodafone.co.uk/") browser.find_element_by_css_selector("#...
Beter's user avatar
  • 131
2 votes
1 answer
65 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 for ...
som ghosh's user avatar
1 vote
3 answers
4k views

How to locate Facebook POST button using Java Selenium WebDriver?

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, ...
Saurav Prasad's user avatar
1 vote
1 answer
2k 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 div#mainPanel....
Andy's user avatar
  • 119
1 vote
1 answer
1k views

how to Iterate a List of links?

This "Books" link shows that it has the following xpath: /html/body/div/div/div/aside/div[2]/ul/li/a Then follows the catalogue categories: Travel, Mystery, etc. Reading the xpath above I see ...
Thufir's user avatar
  • 367
1 vote
1 answer
74 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.
jeevan's user avatar
  • 11
1 vote
3 answers
877 views

What CSS locator can I use when there is no good ID, Name or Class?

How do I build a CSS locator for the "Add Photos/Video" link so I can perform a click event on it? The ID is js_42 which varies and the class is _$qtm_fb2ReactComposerAttachmentSelector_MEDIA which ...
ilm's user avatar
  • 386
1 vote
0 answers
131 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 class=...
ken4ward's user avatar
  • 151
0 votes
1 answer
340 views

how can i capture src in xml by using cssSelector or Xpath?

how can i capture src in following xml by using cssSelector or Xpath ? <INPUT src="/TelsimGlobal/Menu/image3.gif" type=image> i tried to execute following ones but always faced with "Unable to ...
santino87's user avatar
0 votes
1 answer
747 views

Selenium C# Locate Both Data QA Attribute And CSS Class

How do we locate both Data QA Id and CSS Class using Selenium C# ? We're trying to locate both a DataQAid attribute and also see if its class ng-invalid, (Angular Material Textbox Error) This is what ...
Artportraitdesign1's user avatar
0 votes
2 answers
1k views

Verify Text using CSS or Xpath

I am new to automation, Selenium Web Driver and am practicing code using Amazon. I want to verify my logged in user name (Hello, Nichole) on the Amazon Home Page but anything I enter using CSS or ...
nchll's user avatar
  • 13
0 votes
1 answer
438 views

CSS parsing to check color value [duplicate]

I need to make a script that checks if all h1 tags in a page are of a certain hex color. If they are not, test fails. What are the available options for doing this? I'm using selenium with java
user avatar
-3 votes
1 answer
2k views

XPATH FACEBOOK How can i get xpath or css selector ? - selenium/java [closed]

I automated some facebook functions for pratice selenium, but i can't click on search options. How can i try this ? Search: elements:
skape's user avatar
  • 21