css-selectors

Unable to locate element: {“method”:“xpath”,“selector”:“//li[@id=”tablist1-tab3“]”} error using Selenium and Java

為{幸葍}努か 提交于 2020-12-12 04:47:25
问题 I have received this error for several times: Unable to locate element: {"method":"xpath","selector":"//li[@id="tablist1-tab3"]"} Code that I have used is: options.addArguments("--headless"); options.addArguments("window-size=1200x900"); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); WebElement tab = driver.findElement(By.xpath("//li[@id=\"tablist1-tab3\"]")); tab.click(); Can someone help me with this error? 回答1: You need to use WebDriverWait for the elementToBeClickable()

Is there a CSS selector that applies when matching specific values in the URL?

ぃ、小莉子 提交于 2020-12-01 09:36:47
问题 Is there a selector that specifies CSS to only applied when matching a specific URL or part of URL? For example, here is my CSS stylesheet: p { color: green; } url("home.html") { color: blue; } url("about.html") { color: yellow; } path("/path/index*") { color: indigo; } When the user visits home.html I want the home.html selector to be applied. When I'm on the about.html URL I want the about.html to be applied. CSS media queries allow you to switch to a different set of styles when the width

How to click on the ember.js enabled button using Selenium and Python

断了今生、忘了曾经 提交于 2020-11-29 09:55:10
问题 I have been trying to make this clickable and I just cannot understand what I am doing wrong. I am also trying to induce webdriverwait, so that it is clicked when it appears. This is my code so far: def order(k): driver = webdriver.Chrome(os.getcwd()+"\\webdriver\\chromedriver.exe") driver.get("website.com/login-to-checkout") driver.find_element_by_id('i0116').send_keys(k["email"]) driver.find_element_by_id('i0118').send_keys(k["password"]) driver.find_element_by_id('idSIButton9').click()

How to click on the ember.js enabled button using Selenium and Python

别说谁变了你拦得住时间么 提交于 2020-11-29 09:53:05
问题 I have been trying to make this clickable and I just cannot understand what I am doing wrong. I am also trying to induce webdriverwait, so that it is clicked when it appears. This is my code so far: def order(k): driver = webdriver.Chrome(os.getcwd()+"\\webdriver\\chromedriver.exe") driver.get("website.com/login-to-checkout") driver.find_element_by_id('i0116').send_keys(k["email"]) driver.find_element_by_id('i0118').send_keys(k["password"]) driver.find_element_by_id('idSIButton9').click()

Selenium C# ElementNotVisibleException: element not interactable but the element is actually visible

戏子无情 提交于 2020-11-29 08:52:06
问题 I'm using Selenium.WebDriver for C# to ask a question on Quora just typing my question in notepad. Everything worked fine since I had to post it. To post it I need to click on a link inside a span like this: <span id="__w2_wEA6apRq1_submit_question"> <a class="submit_button modal_action" href="#" id="__w2_wEA6apRq1_submit">Add Question</a> </span> In order to click it I've tried this method, that I've used for all my previous button clicks: Selecting the element and clicking it: var element =

How to select only first three elements using CSS

回眸只為那壹抹淺笑 提交于 2020-11-29 04:10:15
问题 How can I select only first three elements with the :nth-child() selector ? section > figure:nth-child( ? ) { /* ... */ } <section> <figure>1</figure> <!-- select this --> <figure>2</figure> <!-- and this --> <figure>3</figure> <!-- and this --> <figure>4</figure> <figure>5</figure> <figure>6</figure> </section> 回答1: You can do it like this: section > figure:nth-child(-n+3) { border: 1px solid; } <section> <figure>1</figure> <figure>2</figure> <figure>3</figure> <figure>4</figure> <figure>5<

How to select only first three elements using CSS

倖福魔咒の 提交于 2020-11-29 04:09:29
问题 How can I select only first three elements with the :nth-child() selector ? section > figure:nth-child( ? ) { /* ... */ } <section> <figure>1</figure> <!-- select this --> <figure>2</figure> <!-- and this --> <figure>3</figure> <!-- and this --> <figure>4</figure> <figure>5</figure> <figure>6</figure> </section> 回答1: You can do it like this: section > figure:nth-child(-n+3) { border: 1px solid; } <section> <figure>1</figure> <figure>2</figure> <figure>3</figure> <figure>4</figure> <figure>5<

CSS: last-child of parent

懵懂的女人 提交于 2020-11-26 10:26:57
问题 :last-child works great when all of the "children" elements are the same (ie: all <p> 's or all <li> 's and the rule is applied to that type of child. But how can I use CSS to select the last "child" element inside a parent which contains varying elements? For instance, in this example, how could I apply a rule to the .parent to select the last object inside of it (the div )? .parent:last-child { background-color: red; } <div class="parent"> <p>First child</p> <input type="text" placeholder=

CSS: last-child of parent

坚强是说给别人听的谎言 提交于 2020-11-26 10:25:47
问题 :last-child works great when all of the "children" elements are the same (ie: all <p> 's or all <li> 's and the rule is applied to that type of child. But how can I use CSS to select the last "child" element inside a parent which contains varying elements? For instance, in this example, how could I apply a rule to the .parent to select the last object inside of it (the div )? .parent:last-child { background-color: red; } <div class="parent"> <p>First child</p> <input type="text" placeholder=

Can you apply CSS rules, in CSS, if a div doesn't exist?

纵饮孤独 提交于 2020-11-25 13:48:17
问题 Is this possible, with CSS ? Apply this rule if .div1 doesn't exist: .div2{ property: value; } like <div class="div1"> ... </div> <div class="div2"> <!-- it exists, so do nothing --> </div> and <div class="div2"> <!-- it doesn't exist, apply the css --> </div> 回答1: If you know the 'unstyled' styles of the div, you could use a css sibling selector to style it one way if it follows .div1, and the 'plain' way if it doesnt - ie .div2 { /* styled however you want */ } .div1 + .div2 { /* 'plain'