selenium

Button not clickable in Selenium Chrome window

限于喜欢 提交于 2021-02-10 06:23:09
问题 I am trying to click a button using Selenium and Python. The very root of this problem that I need to understand is that when Selenium launches the Chrome window the button that I want to click does nothing when clicked. Like if I physically click the button with my mouse nothing happens. It seems to be the only element on the page functioning this way. I can click around other elements on the page and those react just fine. It's almost as if the button becomes "dead" when the browser is

ElementClickInterceptedException: Message: Element is not clickable at point (x,y) because another element obscures it

青春壹個敷衍的年華 提交于 2021-02-10 06:23:08
问题 Hi I continue to get the error, ElementClickInterceptedException: Message: Element is not clickable at point (x,y) because another element obscures it I have tried many work arounds including a time delay and nothing seems to work. i tried some of the solutions here: Selenium Web Driver & Java. Element is not clickable at point (x, y). Other element would receive the click then I get a new error, "cannot scroll down" Appreciate any help. Here is my code: from selenium import webdriver import

python selenium unable to select element

青春壹個敷衍的年華 提交于 2021-02-10 05:40:37
问题 I'm trying to select below element in a webpage. .active > b:nth-child(1) This is my code : timbro = browser.find_element_by_css_selector('.active > b:nth-child(1)') hover = ActionChains(browser).move_to_element(timbro) hover.perform() This is part of the error I'm getting: Message: Unable to locate element: {"method":"css selector","selector":".active > b:nth-child(1)"}" what I'm trying to do is activate a drop down menu so that I can click on another link. HTML Snippet: <li> <a href="#nogo"

Reading title tag in svg?

和自甴很熟 提交于 2021-02-10 05:19:30
问题 How do I read the text in below? svg seems to be a special case. Tried the below, but of no help //*[name()='svg']/title //*[name()='svg' and @title='Test'] //*[name()='svg' and contains(@title,'Test')] <svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 137 125" version="1.1"> <title>Test</title> <desc>Created with Sketch.</desc> 回答1: To extract the text from the <title> tag within the svg WebElement you can use either of the following Locator Strategies: Using

Cloudflare and Chromedriver - cloudflare distinguishes between chromedriver and genuine chrome?

别来无恙 提交于 2021-02-10 04:28:08
问题 I would like to use chromedriver to scrape some stories from fanfiction.net. I try the following: from selenium import webdriver import time path = 'D:\chromedriver\chromedriver.exe' browser = webdriver.Chrome(path) url1 = 'https://www.fanfiction.net/s/8832472' url2 = 'https://www.fanfiction.net/s/5218118' browser.get(url1) time.sleep(5) browser.get(url2) The first link opens (sometimes I have to wait 5 seconds). When I want to load the second url, cloudflare intervens and wants me to solve

Get Absolute XPath of Web Element

陌路散爱 提交于 2021-02-10 04:20:44
问题 I'm using Javascript in the following code to retrieve the absolute XPath of a web element: public String getAbsoluteXPath(WebDriver driver) { return (String) driver.executeScript( "function absoluteXPath(element) {"+ "var comp, comps = [];"+ "var parent = null;"+ "var xpath = '';"+ "var getPos = function(element) {"+ "var position = 1, curNode;"+ "if (element.nodeType == Node.ATTRIBUTE_NODE) {"+ "return null;"+ "}"+ "for (curNode = element.previousSibling; curNode; curNode = curNode

Get Absolute XPath of Web Element

寵の児 提交于 2021-02-10 04:14:43
问题 I'm using Javascript in the following code to retrieve the absolute XPath of a web element: public String getAbsoluteXPath(WebDriver driver) { return (String) driver.executeScript( "function absoluteXPath(element) {"+ "var comp, comps = [];"+ "var parent = null;"+ "var xpath = '';"+ "var getPos = function(element) {"+ "var position = 1, curNode;"+ "if (element.nodeType == Node.ATTRIBUTE_NODE) {"+ "return null;"+ "}"+ "for (curNode = element.previousSibling; curNode; curNode = curNode

Get Absolute XPath of Web Element

人盡茶涼 提交于 2021-02-10 04:09:15
问题 I'm using Javascript in the following code to retrieve the absolute XPath of a web element: public String getAbsoluteXPath(WebDriver driver) { return (String) driver.executeScript( "function absoluteXPath(element) {"+ "var comp, comps = [];"+ "var parent = null;"+ "var xpath = '';"+ "var getPos = function(element) {"+ "var position = 1, curNode;"+ "if (element.nodeType == Node.ATTRIBUTE_NODE) {"+ "return null;"+ "}"+ "for (curNode = element.previousSibling; curNode; curNode = curNode

How to do Mouse hover on Image in selenium web driver to get menu list

你离开我真会死。 提交于 2021-02-10 03:20:54
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover

How to do Mouse hover on Image in selenium web driver to get menu list

佐手、 提交于 2021-02-10 03:07:24
问题 I am trying to mouse hover on image to display menu list. My HTML code is: <img id="logo" src="/web/images/header/img_Logo_Topbar.png"> But I am trying Xpath as "//*[@id='logo']" . There is no response. I am using this script: Actions a1 = new Actions(driver); a1.moveToElement(driver.findElement(By.xpath("//*[@id='logo']"))) .build() .perform(); Thread.sleep(1000L); 回答1: It's looks like a bug, I'm not sure what is the solution for this but if you want alternate solution to perform mouse hover