selenium-webdriver

Selenium (Python) >> selenium.common.exceptions.NoSuchFrameException:

只愿长相守 提交于 2021-02-05 08:11:10
问题 I've been trying to enter to an iframe and write text in a search bar ( tag) in Safari: I can't post the html because it's huge and it isn't mine but this is the iframe code: <iframe frameborder="0" id="contentIFrame0" name="contentIFrame0" title="Área de contenido" style="border: 0px none; overflow: hidden; position: absolute; left: 0px; right: 0px; height: 100%; width: 100%; visibility: visible; display: block;"> (...Content of the iframe...) </iframe> Here is python code: wait.until(ec

java.lang.ClassCastException: java.base/java.lang.String cannot be cast to org.openqa.selenium.WebElement when executing test through Selenium

拜拜、爱过 提交于 2021-02-05 08:10:19
问题 I'm trying make an automation test in Selenium WebDriver, but Eclipse is showing me the following error: java.lang.ClassCastException: java.base/java.lang.String cannot be cast to org.openqa.selenium.WebElement Here is my code: public void SeachApp() { Object elem = driver.getPageSource().contains("Staffing"); if (elem != null) { System.out.println("Encontrado"); int width = ((WebElement) elem).getSize().getWidth(); Actions act = new Actions(driver); act.moveToElement((WebElement) elem)

java.lang.ClassCastException: java.base/java.lang.String cannot be cast to org.openqa.selenium.WebElement when executing test through Selenium

只谈情不闲聊 提交于 2021-02-05 08:09:05
问题 I'm trying make an automation test in Selenium WebDriver, but Eclipse is showing me the following error: java.lang.ClassCastException: java.base/java.lang.String cannot be cast to org.openqa.selenium.WebElement Here is my code: public void SeachApp() { Object elem = driver.getPageSource().contains("Staffing"); if (elem != null) { System.out.println("Encontrado"); int width = ((WebElement) elem).getSize().getWidth(); Actions act = new Actions(driver); act.moveToElement((WebElement) elem)

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 = "//*

Python selenium to extract elements with xpath and for loop

自古美人都是妖i 提交于 2021-02-05 07:49:06
问题 I am using Python/Selenium to extract some text from a website to further sort it in Google Sheets. There are 15 headers for which I need to extract text. The text is found under each header in tag h5. Here's one extract of a header: <tr class="dayHeader"> <td colspan="7" style="padding:10px 0;"> <hr> <h5>  Tuesday - 02 February 2021</h5> </td> </tr> What I have done is the following: headers = driver.find_elements_by_tag_name('h5') results = [] for header in headers: result = header.text

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

What are properties of find_element_by_class_name in selenium python?

与世无争的帅哥 提交于 2021-02-05 07:40:28
问题 browser = webdriver.Firefox() browser.get(url) divs = browser.find_elements_by_class_name('class') Are there any properties of browser.find_element_by_class_name('class')? For example if I have code like that: <div class="foo"> <a href="" class="poo">one</a> <a href="" class="poo">two</a> <a href="" class="poo">three</a> </div> <div class="foo"> <a href="" class="koo">one</a> <a href="" class="koo">two</a> <a href="" class="koo">three</a> </div> I want to get text from 'a' tags. But firstly I

How get the text from the <p> tag using XPath Selenium and Python

坚强是说给别人听的谎言 提交于 2021-02-05 07:39:16
问题 I need to catch with XPath one line from a text inside a <p> . I need to store the text Content-type: text/plain; charset=us-ascii into a variable in python but i get the next error: selenium.common.exceptions.WebDriverException: Message: TypeError: Expected an element or WindowProxy, got: [object Text] {} Here is the code im trying: import selenium.webdriver as webdriver browser = webdriver.Firefox() browser.get('https://www.w3.org/Protocols/rfc1341/7_1_Text.html') foo = browser.find_element

Mozilla Firefox 68.2.0esr browser is crashing using GeckoDriver and Selenium

我们两清 提交于 2021-02-05 07:19:25
问题 I was trying to launch Firefox browser through selenium, but unfortunately browser is getting closed immediately after it launches. I couldn't interpret from the log file. Here are the log file entries: 1582121786461 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.d4XupquDfaWC" 1582121787117 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid

Mozilla Firefox 68.2.0esr browser is crashing using GeckoDriver and Selenium

Deadly 提交于 2021-02-05 07:19:08
问题 I was trying to launch Firefox browser through selenium, but unfortunately browser is getting closed immediately after it launches. I couldn't interpret from the log file. Here are the log file entries: 1582121786461 mozrunner::runner INFO Running command: "/usr/bin/firefox" "-marionette" "-foreground" "-no-remote" "-profile" "/tmp/rust_mozprofile.d4XupquDfaWC" 1582121787117 addons.webextension.screenshots@mozilla.org WARN Loading extension 'screenshots@mozilla.org': Reading manifest: Invalid