css-selectors

How to identify an element through classname even though there are multiple elements with the same classnames using Selenium and Python

点点圈 提交于 2021-01-20 07:30:00
问题 <div class="_2S1VP copyable-text selectable-text" data-tab="1" dir="ltr" spellcheck="true" contenteditable="true"></div> <div class="_2S1VP copyable-text selectable-text" data-tab="3" dir="ltr" contenteditable="true"></div> I'm a beginner and I've had a hard time distinguishing / specifying the first class over the second one typing = bot.find_element_by_xpath('//div[@class = "_1Plpp"]') this doesn't seem to work and just using the class name always brings up the unwanted second one with the

Unable to type within username field within ProtonMail signup page using Selenium and Python

那年仲夏 提交于 2021-01-13 09:42:42
问题 Hi I was trying to type the username field using Selenium and Python for the website https://mail.protonmail.com/create/new?language=en. From the developer tool, I am able to inspect the item using CSSSelector/Xpath or other way. But when I am running the pthon script its not working. Screenshot attached: My code is like the following: BASE_URL = 'https://mail.protonmail.com/create/new?language=en' driver = webdriver.Chrome(executable_path='./drivers/chromedriver') driver.get(BASE_URL) river

How to select options from 3 interlinked dropdowns with the same class name and different values using Selenium and Java

早过忘川 提交于 2021-01-07 06:57:06
问题 I have 3 options in a home page with the same class name and different values see code bellow: First Option menu <select class="form-control mandatory" tabindex="4" required="" autocomplete="off" name="SearchHome.documentType"> <option value=""></option> <option value="VISA">Visa</option> <option value="EDF">EDF</option> </select> Second Option menu <select class="form-control mandatory" tabindex="5" required="" autocomplete="off" name="SearchHome.documentSubType"> <option value=""></option>

CSS :last-child AND :hover on an a link in a ul

夙愿已清 提交于 2021-01-07 03:26:33
问题 I'm styling the last child of a navigation menu which I seem to be able to do fine with the following code: .aston-menu-light ul > li:last-child { border:2px solid blue; border-radius: 50px; padding:0 20px 0 20px; } .aston-menu-light ul > li > ul > li:last-child { border:none !important; padding:0 !important; } .aston-menu-light ul > li:last-child:hover { background-color:#ffff; -webkit-transition: all .5s; -o-transition: all .5s; transition: all .5s; } The trouble comes when I try and target

Best practice to use aria-label as a selector for styling

风流意气都作罢 提交于 2020-12-30 06:17:29
问题 I am styling a table that has table cells with (non-interactive) checkmarks in it. The checkmark icons are added via CSS. As there is no accessible content in it, I added an aria-label to it. Now I wonder if it is a good idea to use this attribute as a CSS selector to add those checkmark icons like this: td[aria-label="yes"] { &:after { content: '\f00c'; font-family: $font-family-icons; } } I learned that using ARIA attributes as selectors is generally a good practice, at least for state

CSS for same level

有些话、适合烂在心里 提交于 2020-12-29 13:22:45
问题 If I have 3 divs at the same level ( not one in another ) . How can I change the color of the other div when hover one without using IDs and classes. I would like somthing like : <div id="1" ></div> <div></div> <div></div> And CSS : #1 :hover < body > div { //Here I change the things } 回答1: Use the general sibling combinator #yourId:hover ~ div { color:red; } Also note that Id's must begin with a letter. W3 ID Attribute Example 回答2: Put a wrapper around them, then put the hover on the wrapper

CSS for same level

為{幸葍}努か 提交于 2020-12-29 13:22:23
问题 If I have 3 divs at the same level ( not one in another ) . How can I change the color of the other div when hover one without using IDs and classes. I would like somthing like : <div id="1" ></div> <div></div> <div></div> And CSS : #1 :hover < body > div { //Here I change the things } 回答1: Use the general sibling combinator #yourId:hover ~ div { color:red; } Also note that Id's must begin with a letter. W3 ID Attribute Example 回答2: Put a wrapper around them, then put the hover on the wrapper

How to select element by 'role' attribute and filter by class with vanilla JS?

被刻印的时光 ゝ 提交于 2020-12-28 21:17:57
问题 Markup: <ul> <li role="presentation" class="active"> <a href="#1" aria-controls="1" role="tab">How to Install for iPad</a> </li> <li role="presentation"> <a href="#2" aria-controls="2" role="tab">How to Install for Mac</a> </li> <li role="presentation"> <a href="#3" aria-controls="3" role="tab">How to Install for PC</a> </li> </ul> When I use document.querySelectorAll('[role="presentation"]'); the result is array [li.active,li,li] How can I remove .active class and attach it to any other of

How to select element by 'role' attribute and filter by class with vanilla JS?

对着背影说爱祢 提交于 2020-12-28 21:09:20
问题 Markup: <ul> <li role="presentation" class="active"> <a href="#1" aria-controls="1" role="tab">How to Install for iPad</a> </li> <li role="presentation"> <a href="#2" aria-controls="2" role="tab">How to Install for Mac</a> </li> <li role="presentation"> <a href="#3" aria-controls="3" role="tab">How to Install for PC</a> </li> </ul> When I use document.querySelectorAll('[role="presentation"]'); the result is array [li.active,li,li] How can I remove .active class and attach it to any other of

How to select element by 'role' attribute and filter by class with vanilla JS?

怎甘沉沦 提交于 2020-12-28 21:07:56
问题 Markup: <ul> <li role="presentation" class="active"> <a href="#1" aria-controls="1" role="tab">How to Install for iPad</a> </li> <li role="presentation"> <a href="#2" aria-controls="2" role="tab">How to Install for Mac</a> </li> <li role="presentation"> <a href="#3" aria-controls="3" role="tab">How to Install for PC</a> </li> </ul> When I use document.querySelectorAll('[role="presentation"]'); the result is array [li.active,li,li] How can I remove .active class and attach it to any other of