xpath

Unable to login with python selenium error:NoSuchElementException error

这一生的挚爱 提交于 2021-02-11 13:02:48
问题 I have tried locating the submit button by id and xpath but none of them worked and checked in the page source ,the id is same.I have no idea why this is happening even though I am giving the correct Id or xpath URL : https://moodle.niituniversity.in/moodle/login/index.php from pyvirtualdisplay import Display from selenium import webdriver from selenium.webdriver.common.keys import Keys display = Display(visible=0, size=(1024, 768)) display.start() driver = webdriver.Firefox() #driver.set

Xpath to select elements that has specific child [duplicate]

孤街醉人 提交于 2021-02-11 12:44:49
问题 This question already has answers here : XPath - Get node with no child of specific type (5 answers) Closed 6 years ago . <item id=1> <name>item1</name> <price>30</price> </item> <item id=2> <name>item2</name> </item> I need an xpath to select only items that DO NOT have price for .net. 回答1: For your original question: item[price] will give you all item elements that have a price element child. This includes an empty <price/> so if you want to avoid matching <item> <name>item3</name> <price><

nested looping within Xquery results in a mismatch? and idioms

北城以北 提交于 2021-02-11 12:29:38
问题 I'm playing with the bookstore XML from w3schools: <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt

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

Unable to get an element via query on attribute(containing hyphens) value using an XPATH

旧巷老猫 提交于 2021-02-11 12:23:06
问题 I'm facing a very weird scenario in getting an element having an attribute using an XPATH. The problem is that if the attribute contains more than one Hyphens in it then Selenium is unable to find that element. I am using Python and Selenium 2.52.0 Example that works fine. <span data-one="containingOnlyOneHyphen"> </span> XPATH = '//*[@data-one="containingOnlyOneHyphen"]' (Works Completely Fine) Example that doesn't work. <span data-one-two="containingTwoHyphen"> </span> XPATH = '//*[@data

C# XmlDocument SelectSingleNode without attribute

♀尐吖头ヾ 提交于 2021-02-11 10:28:07
问题 I need to get xml node which misses specific argument. Let's say I have following c:\temp\a.xml: <files> <file product="myproduct">C:\file_myproduct</file> <file>C:\file_general</file> </files> How can I get the C:\file_general value which has no attribute? I tried: var doc = new XmlDocument(); doc.Load(@"c:\temp\a.xml"); // C:\file_myproduct - good string myproduct = doc.SelectSingleNode("/files/file[@product='myproduct']").InnerText; // I need C:\file_general here, but this gives again the

C# XmlDocument SelectSingleNode without attribute

邮差的信 提交于 2021-02-11 10:27:31
问题 I need to get xml node which misses specific argument. Let's say I have following c:\temp\a.xml: <files> <file product="myproduct">C:\file_myproduct</file> <file>C:\file_general</file> </files> How can I get the C:\file_general value which has no attribute? I tried: var doc = new XmlDocument(); doc.Load(@"c:\temp\a.xml"); // C:\file_myproduct - good string myproduct = doc.SelectSingleNode("/files/file[@product='myproduct']").InnerText; // I need C:\file_general here, but this gives again the

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

Not able to get element by xpath inside div with ::before

假装没事ソ 提交于 2021-02-11 02:11:14
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1:

Not able to get element by xpath inside div with ::before

南楼画角 提交于 2021-02-11 02:04:34
问题 I need to get the list of web elements by using web driver object findElements(By.xpath("")); I get the list by using xpath as //*[@class=\"providers-list clearfix\"] .However, I get an error whenever I try to fetch element inside <div class="providers-list clearfix">::before <div class="data-container">..</div> </div> This xpath gives me error: // [@class=\"data-container\"]" as no such element: Unable to locate element: {"method":"xpath","selector":"// [@class="data-container"]"} 回答1: