css-selectors

How to click on a username within web.whatsapp.com using Selenium and Python

时间秒杀一切 提交于 2021-02-11 12:27:01
问题 The bot is supposed to send message on whatsApp WEB but unfortunately is stopping and giving error when asked find the user through X-path. from selenium import webdriver from selenium.webdriver.common.keys import Keys import time driver=webdriver.Chrome(executable_path="C:\drivers\chromedriver.exe") driver.get("https://web.whatsapp.com/") time.sleep(5) name= input("Enter name") input("Enter anything after scanning") time.sleep(2) user=driver.find_element_by_xpath("//span[@title='{}']".format

How to position a div with css based on the order of this div in a list of divs?

烂漫一生 提交于 2021-02-11 07:57:23
问题 Okay, I want to position overlapping elements based on the order they appear in a list. So the first will not be translated, the second will be translated 60px, the third 120px, etc... This is just a simplified version of what I achieve. Also, in the example there are three elements, in real life I won't know how many elements there will be. This is variable. Below is a simple snippet that can achieve what I want, but you can easily see the problem with this: way to many lines of css... So

OpenQA.Selenium.NoSuchElementException: Unable to locate element error while locating an element on a page using Selenium and C#

核能气质少年 提交于 2021-02-11 05:53:33
问题 I am trying to scrape the text 睡觉 within the page edited out the site It has the css selector: #autocplt_wrap > ul:nth-child(1) > li:nth-child(1) > span:nth-child(1) > a:nth-child(1) And x-Path: /html/body/div[2]/div[1]/div[3]/div[2]/div[1]/div/div[1]/div[2]/div/div/ul[1]/li/span/a[1] My code is: IWebDriver driver = new FirefoxDriver(); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); //load webdriver driver.Manage(); driver.Navigate().GoToUrl("https://dict.naver.com

Can I combine :nth-child() or :nth-of-type() with an arbitrary selector?

谁说我不能喝 提交于 2021-02-10 16:02:33
问题 Is there a way to select every nth child that matches (or does not match) an arbitrary selector ? For example, I want to select every odd table row, but within a subset of the rows: table.myClass tr.row:nth-child(odd) { ... } <table class="myClass"> <tr> <td>Row <tr class="row"> <!-- I want this --> <td>Row <tr class="row"> <td>Row <tr class="row"> <!-- And this --> <td>Row </table> But :nth-child() just seems to count all the tr elements regardless of whether or not they're of the "row"

Can I combine :nth-child() or :nth-of-type() with an arbitrary selector?

感情迁移 提交于 2021-02-10 16:00:35
问题 Is there a way to select every nth child that matches (or does not match) an arbitrary selector ? For example, I want to select every odd table row, but within a subset of the rows: table.myClass tr.row:nth-child(odd) { ... } <table class="myClass"> <tr> <td>Row <tr class="row"> <!-- I want this --> <td>Row <tr class="row"> <td>Row <tr class="row"> <!-- And this --> <td>Row </table> But :nth-child() just seems to count all the tr elements regardless of whether or not they're of the "row"

Can I combine :nth-child() or :nth-of-type() with an arbitrary selector?

蹲街弑〆低调 提交于 2021-02-10 16:00:12
问题 Is there a way to select every nth child that matches (or does not match) an arbitrary selector ? For example, I want to select every odd table row, but within a subset of the rows: table.myClass tr.row:nth-child(odd) { ... } <table class="myClass"> <tr> <td>Row <tr class="row"> <!-- I want this --> <td>Row <tr class="row"> <td>Row <tr class="row"> <!-- And this --> <td>Row </table> But :nth-child() just seems to count all the tr elements regardless of whether or not they're of the "row"

How to select an element based on a polyline using Selenium and Python?

孤街醉人 提交于 2021-02-10 15:41:21
问题 I am trying to select and click on an element in Selenium, but it doesn't have the typical tags, and the xpath changes on reload. The symbol stays consistent though, and I want to be able to select the button using the symbol. The HTML looks like this: <svg x="0px" y="0px" viewBox="0 0 40 34" enable-background="new 0 0 40 34" focusable="false" style="fill: rgb(255, 255, 255); stroke-width: 0px; width: 100%; --darkreader-inline-fill:#e8e6e3;" data-darkreader-inline-fill=""> <g fill="none"

How to select the auto suggestion from the dynamic dropdown using Selenium and Java

大城市里の小女人 提交于 2021-02-10 13:06:16
问题 I am trying to select the value for Subjects field in the following form: https://demoqa.com/automation-practice-form It is an input field that dynamically gives suggestions based on our input and later we need to select values from those suggestions. I am unable to select the desired value. The Below code only populates the input area but the value is not selected. driver.findElement(By.id("subjectsInput")).sendKeys("English"); driver.findElement(By.id("subjectsInput")).click(); //This line

How to select the auto suggestion from the dynamic dropdown using Selenium and Java

China☆狼群 提交于 2021-02-10 13:03:32
问题 I am trying to select the value for Subjects field in the following form: https://demoqa.com/automation-practice-form It is an input field that dynamically gives suggestions based on our input and later we need to select values from those suggestions. I am unable to select the desired value. The Below code only populates the input area but the value is not selected. driver.findElement(By.id("subjectsInput")).sendKeys("English"); driver.findElement(By.id("subjectsInput")).click(); //This line

How to identify a particular Page Object fragment member element through Selenium

淺唱寂寞╮ 提交于 2021-02-10 12:53:01
问题 In our project we have multiple selenium tests run with cucumber which are testing specific components. One of these components are two identifiers, which we call country identifier and site identifier. These have the following HTML: <div class="identifiers"> <div class="country-identifier"> <span class="ident-label"> Germany </span> </div> <div class="site-identifier"> <span class="ident-label"> Gaming </span> </div> </div> Now our tests have two models, one for each identifier: @PageObject