css-selectors

CSS: Can I select data value greater than?

╄→尐↘猪︶ㄣ 提交于 2020-06-23 05:05:08
问题 <div data-age="30">30</div> Is there a way to have (PURE CSS) div in red when age<18 and in blue where age>18 回答1: Here is an idea based on this previous answer where you can consider CSS variables: .box { font-size:30px; padding:5px; display:inline-block; font-family:monospace; overflow:hidden; color:#fff; background: linear-gradient(red,red) 0 0/100% calc((18 - var(--a))*1px), blue; } .box:before { content:attr(style); text-indent:-4ch; display:inline-block; } <div style="--a:30" class="box

Why :before cannot be seen in safari?

谁说我不能喝 提交于 2020-06-23 03:06:16
问题 I have a code which works brilliant in Chrome: #menu ul { list-style-position: inside; list-style-type: none; display: block; margin: 0 auto; padding: 0; } #menu li { font-size: 11px; width: 95px; display: inline-block; vertical-align: top; position: relative; } #menu li a { color: black; text-decoration: none; } #menu li a img { opacity: 0; filter: alpha(opacity=0); -moz-opacity: 0; position: absolute; top: 0; left: 22px; margin: 0 auto; -webkit-transition: opacity 0.2s linear; -moz

How to find elements without using the tag attribute?

倾然丶 夕夏残阳落幕 提交于 2020-06-16 17:25:42
问题 image = driver.find_elements_by_xpath("//img[contains(@class,'ui_qtext')]") copy = driver.find_elements_by_xpath("//p[contains(@class,'ui_qtext')]") I have this two elements with different tag_names. How do i locate them without the tag_name? Or how do i "combine" this two? Both have the same class_name. 回答1: To remove the dependency on the tagNames you can use either of the following Locator Strategies: Using xpath : image_copy = driver.find_elements_by_xpath("//*[contains(@class,'ui_qtext')

Protractor Conditional Selector

亡梦爱人 提交于 2020-06-08 12:37:53
问题 I am using Selenium Protractor and want to select all elements from the following list except one that contains text "Cat" and then perform some operations on the remaining ones. <div class="mainDiv"> <div class="childDiv">Dog</div> <div class="childDiv">Goat</div> <div class="childDiv">Bird</div> <div class="childDiv">Cat</div> <div class="childDiv">Zebra</div> </div> Is there a selector by cssContainingText (or some other) in which I can give a condition to select all elements except the

How to click on a element through Selenium Python

孤街浪徒 提交于 2020-06-06 08:18:08
问题 I'm trying to fetch data for facebook account using selenium browser python but can't able to find the which element I can look out for clicking on an export button. See attached screenshot I tried but it seems giving me an error for the class. def login_facebook(self, username, password): chrome_options = webdriver.ChromeOptions() preference = {"download.default_directory": self.section_value[24]} chrome_options.add_experimental_option("prefs", preference) self.driver = webdriver.Chrome(self

how to run a .click on elems parent sibling selector?

☆樱花仙子☆ 提交于 2020-06-01 05:06:48
问题 Below is my most recent attempt: var aSl = document.querySelector('input[id^="blahblah"]'); aSl.closest("span.k-icon.k-i-expand").click(); It returned: myjs.js:181 Uncaught TypeError: Cannot read property 'closest' of null I have also tried parent.sibling in place of .closest above - that returned '...parent is not a function' error. Below is my mark-up: <span class="k-icon k-i-expand">::before</span> <--- this is what I'm trying to run .click() on <span class="k-checkbox-wrapper"> <input

How to scrape all the search results using Selenium webdriver and Python

爷,独闯天下 提交于 2020-05-31 04:55:05
问题 I'm trying to scrape all CRD# from the search result from this site https://brokercheck.finra.org/search/genericsearch/list (You'll need to redo the search when you click on the link, just type some random stuff for the Individual search) I'm using driver.find_elements_by_xpath to target all CRD numbers on each result page. However, I've been playing around with the paths for a while but the webdriver still can't pick up the CRDs from the site. I currently have (in Python) crds = driver.find

:host getting oveerirden by universal selector css

▼魔方 西西 提交于 2020-05-23 21:32:08
问题 We have CSS resets (margin:0px;padding:0px;) in a common style file which we have authored as one component and have included as a part of other components which we are developing. We are using universal selectors like below *,*:before,*:after{ color:pink } On each of our component we have a :host style with which we are trying to override this color :host{ color:yellow } As we expect :host to have more specificity over universal selector strangely this is not the case. universal selector

How to remove border from elements in the last row?

≡放荡痞女 提交于 2020-05-23 08:00:09
问题 My layout is something like this (I'm typing a simplified version with inline styles instead of classes) .qa { border-bottom: 1px solid #ccc; } <div style="display: flex; flex-wrap: wrap; flex-direction: row"> <div class="qa" style="width:50%;"> <div>Question</div> <div>Answer</div> </div> <div class="qa" style="width:50%;"> <div>Question</div> <div>Answer</div> </div> <div class="qa" style="width:50%;"> <div>Question</div> <div>Answer</div> </div> <div class="qa" style="width:50%;"> <div

How locate the pseudo-element ::before using Selenium Python

醉酒当歌 提交于 2020-05-21 07:10:46
问题 I'm using Selenium Python to locate label element.I want to use ::before to locate it,because this is a pop window. <div class="crow" grp="0" grpname="Pizza Size"> ::before <label class="label0" cid="1"> <input type="radio" name="0" coname="M" sname="" price="9.99" value="392">M<b class="ip">9.99</b> </label> <label class="label0" cid="1"><input type="radio" name="0" coname="L" sname="" price="11.99" value="393">L<b class="ip">11.99</b> </label><div style="clear:both"> </div> </div> I have no