xpath

Cant find root elements with RemoteWebDriver.FindElementsByXPath(“/”);

梦想的初衷 提交于 2020-08-08 03:58:32
问题 When I try to use var element = webdriver.FindElementByXPath("/"); or var elements = webdriver.FindElementsByXPath("/"); I expect to get the root element(s) of my document. What I get instead is an InvalidSelectorException with this message. "invalid selector: The result of the xpath expression "/" is: [object HTMLDocument]. It should be an element. (Session info: chrome=50.0.2661.102) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 10.0

How to find elements that do not include a certain class name with selenium and python

橙三吉。 提交于 2020-08-02 16:22:56
问题 I want to find all the elements that contain a certain class name but skip the ones the also contain another class name beside the one that i am searching for I have the element <div class="examplenameA"> and the element <div class="examplenameA examplenameB"> At the moment i am doing this to overcome my problem: items = driver.find_elements_by_class_name('examplenameA') for item in items: cname = item.get_attribute('class') if 'examplenameB' in cname: pass else: rest of code I only want the

How to find elements that do not include a certain class name with selenium and python

柔情痞子 提交于 2020-08-02 16:22:16
问题 I want to find all the elements that contain a certain class name but skip the ones the also contain another class name beside the one that i am searching for I have the element <div class="examplenameA"> and the element <div class="examplenameA examplenameB"> At the moment i am doing this to overcome my problem: items = driver.find_elements_by_class_name('examplenameA') for item in items: cname = item.get_attribute('class') if 'examplenameB' in cname: pass else: rest of code I only want the

xpath parent attribute of selection

五迷三道 提交于 2020-08-01 05:24:48
问题 Syntax of the xml document: <x name="GET-THIS"> <y> <z>Z</z> <z>Z__2</z> <z>Z__3</z> </y> </x> I'm able to get all z elements using: xpath("//z") But after that I got stuck, I'm not sure what to do next. I don't really understand the syntax of the .. parent method So, how do I get the attribute of the parent of the parent of the element? 回答1: Instead of traversing back to the parent, just find the right parent to begin with: //x will select all x elements. //x[//z] will select all x elements

ElementNotInteractableException: Message: element not interactable error sending text in search field using Selenium Python

心已入冬 提交于 2020-07-30 11:43:08
问题 I try to use send_keys on a website, which gives me an error of element not interatable. Here is my code below: import selenium from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.by import By from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.select import Select from selenium

Why XPath does not highlighted the yellow mark in Chrome84?

南楼画角 提交于 2020-07-30 08:02:12
问题 The bounty expires in 2 days . Answers to this question are eligible for a +50 reputation bounty. DebanjanB is looking for a canonical answer : Looking for an answer drawing from credible and/or official sources. Why XPath does not highlight the yellow mark? I try to find the XPath at www.google.com //*[@id="fakebox-input"] It is found but not highlighted being the yellow mark on Chrome so it's hard for me to found out exactly where is the XPath and to see the XPath correct or not. Is there a

Using Selenium in Python to enter currency format text

一曲冷凌霜 提交于 2020-07-23 05:20:07
问题 Trying to enter the value "100000" into a web form using Selenium in Python, but it is consistently not working no matter how I try to send it. I apologize for my lack of knowledge about the terminology. I will try my best but I am self-taught and a novice. Also, I apologize but I cannot tell you the website or my employer would not be very happy. The box on the webpage is automatically populated with a dollar sign. I know that the box in the web form is expecting an integer in currency

Using Selenium in Python to enter currency format text

回眸只為那壹抹淺笑 提交于 2020-07-23 05:18:05
问题 Trying to enter the value "100000" into a web form using Selenium in Python, but it is consistently not working no matter how I try to send it. I apologize for my lack of knowledge about the terminology. I will try my best but I am self-taught and a novice. Also, I apologize but I cannot tell you the website or my employer would not be very happy. The box on the webpage is automatically populated with a dollar sign. I know that the box in the web form is expecting an integer in currency

How to click on GWT enabled elements using Selenium and Python

醉酒当歌 提交于 2020-07-23 04:56:17
问题 I'm working with Selenium as a newbie and also as a newbie developer. I try to solve this XPath but with no results that is why I'm looking for help. So I want to click in the checkbox which has a dynamic id but it is not that easy to find this checkbox based on tittle="Viewers" Please notice there is a whole list of checkboxes with names on right from a checkbox in div which I want to include in my tests. HTML: <span class="row-selection"><input type="checkbox" value="on" id="gwt-uid-2215"

How to click on GWT enabled elements using Selenium and Python

ⅰ亾dé卋堺 提交于 2020-07-23 04:55:11
问题 I'm working with Selenium as a newbie and also as a newbie developer. I try to solve this XPath but with no results that is why I'm looking for help. So I want to click in the checkbox which has a dynamic id but it is not that easy to find this checkbox based on tittle="Viewers" Please notice there is a whole list of checkboxes with names on right from a checkbox in div which I want to include in my tests. HTML: <span class="row-selection"><input type="checkbox" value="on" id="gwt-uid-2215"