css-selectors

WebDriver with Java - Not able to get all the text using Webdriver

不问归期 提交于 2021-02-05 08:15:28
问题 I'm not able to get all the text on this website - https://niftygateway.com/marketplace Using this simple code - String iterativeXpath = "(//*[@id='root']/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div/div)"; iterativeXpath = iterativeXpath.substring(0, iterativeXpath.length()-1); WebDriverWait wait = new WebDriverWait(driver, 15); for(int i = 1; i <=20; i++){ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(iterativeXpath+"["+i+"])"))); System.out.println(driver.findElement

How to select an option from the dropdown menu using Selenium and Python

倾然丶 夕夏残阳落幕 提交于 2021-02-05 08:12:26
问题 I am trying to get the fares for all combinations of stations in Metro-North using Selenium in Python. I wanted to go to their fare page, put station names into the select fields, click on the fare button, and then copy the needed values to the dataframe. I tried all possible options to select stations from the dropdown menu but nothing works as I get the error: ElementNotInteractableException . The code I tried: driver = webdriver.Safari() driver.get('http://as0.mta.info/mnr/schedules/sched

How to select an option from the dropdown menu using Selenium and Python

折月煮酒 提交于 2021-02-05 08:12:08
问题 I am trying to get the fares for all combinations of stations in Metro-North using Selenium in Python. I wanted to go to their fare page, put station names into the select fields, click on the fare button, and then copy the needed values to the dataframe. I tried all possible options to select stations from the dropdown menu but nothing works as I get the error: ElementNotInteractableException . The code I tried: driver = webdriver.Safari() driver.get('http://as0.mta.info/mnr/schedules/sched

selenium.common.exceptions.WebDriverException: Message: Failed to convert data to an object while trying to click an element with Selenium and Python

a 夏天 提交于 2021-02-05 08:09:59
问题 im trying to click a button on a page after logging in the button is the following HTML <div id="carrierDashboardControls"> <button class="yms-button-primary" ng-click="refresh()"> <t>Refresh</t> </button> <button class="yms-button-primary-alt ng-isolate-scope" ng-csv="fetchData()" lazy-load="true" csv-header="getCsvHeader" filename="carrier-dashboard.csv" field-separator=",">CSV </button> </div> there are 2 buttons in this and i want to click the one with class "yms-button-primary-alt ng

How to get all text from different elements under one div

孤人 提交于 2021-02-05 07:51:32
问题 I have problem, here is html pseudocode: <div class="content" id="ui6" role ="tabpanel"> <p> text </p> <ul> <li> text2 </li> <li> text3 </li> </ul> </div> I want to get text, text2 and text3 and print them, but I can only manage to get "text". Here is the code: List<WebElement> sectionThreeText = driver.findElements(By.cssSelector("#ui6")); for(WebElement e : sectionThreeText) { System.out.println(e.getText()); } I tried also find it by: css = "#ui6 > p ul" xpath = "//*[@id=ui6]" xpath = "//*

ElementNotInteractableException: Message: Element could not be scrolled into view using GeckoDriver Firefox with Selenium WebDriver

偶尔善良 提交于 2021-02-05 07:45:06
问题 How can I fix the error: selenium.common.exceptions.ElementNotInteractableException: Message: Element <> could not be scrolled into view error when working with Firefox via Selenium? None of the tips from the site did not help me. I tried all the solutions I could find, including through WebDriverWait and JS. One of the solutions gave: selenium.common.exceptions.MoveTargetOutOfBoundsException: Message: (568, 1215) is out of bounds of viewport width (1283) and height (699) I tried resizing the

How to get text from textnodes seperated by whitespace using Selenium and Python

♀尐吖头ヾ 提交于 2021-02-05 07:44:49
问题 I am on this page: https://fantasy.premierleague.com/statistics When you click on any "i" icon next to a player, a popup window appears. Then, i want to get the surname of the player. This is how "inspect element" looks like ("whitespace" actually appears within a box): <h2 class="ElementDialog__ElementHeading-gmefnd-2 ijAScJ"> Kevin whitespace De Bruyne What i want to do is to take the text that appears after the whitespace. I can get the full text (ie both name and surname) using this:

How to write multiple css selectors in one line?

ぃ、小莉子 提交于 2021-02-05 06:44:26
问题 My problem is that i want to write this in single selection : .btn-primary > i.glyphicon { color: #ffffff; } .btn-primary > span.glyphicon { color: #ffffff; } But this : .btn-primary > i.glyphicon, span.glyphicon { color: #ffffff; } doesnt work. Because all the span.glyphicon tags are geting white color. How do solve this? 回答1: Comma separate them: .btn-primary > i.glyphicon, .btn-primary > span.glyphicon { color: #ffffff; } More info can be found at w3.org about grouping. If you want to

CSS select first child if it's a certain tag

隐身守侯 提交于 2021-02-05 06:12:08
问题 I need to select a particular element only if it occurs as the first child of a div. Is there a CSS selector that'll handle that case? For example, I want to select this figure: <div> <figure></figure> <p></p> <p></p> </div> But I don't want to select this one: <div> <p></p> <figure></figure> <p></p> </div> I can't change the HTML, so I can't add a class. I know about the :first-child and :first-of-type selectors, but they don't fit this case by themselves. How can I select the first child

CSS selector for only two classes and no others

爱⌒轻易说出口 提交于 2021-02-05 06:05:37
问题 I am looking for some kind of CSS selector that will only select certain cells from a table that only have these two specific classes and nothing else. Here is an example for a bit more clarity. So in this table i want to select cells A and D for styling from the row but the only distinguishable way to select them is that they don't have any classes other than .abc and .xyz. So essentially i need to fitler out any cells that have any other classes i.e. .def, .ghi. <tr> <td class="abc xyz">A<