webdriverwait

Is it possible to switch to an element in a frame without using driver.switchTo().frame(“frameName”) in Selenium Webdriver Java?

感情迁移 提交于 2019-12-17 03:43:08
问题 I have a multiple nested frames and I need to access the elements under these. As these frames are dynamic I am not able to access these elements. Is it possible for me to access the elements without using driver.switchTo().frame() ? Like using the xpath directly or jquery, javascript or anything? Any suggestions are welcome 回答1: In simple words, No , it wouldn't be possible to access the elements without switching into the intended <iframe> i.e. without using driver.switchTo().frame() To

Can't find the element and can't define name “…”

半城伤御伤魂 提交于 2019-12-14 02:12:38
问题 I want to build an auto login bot or something. It has two parts: 1.login 2.verify login The last line of the login part finds and clicks on a button(Log In). When I run only the login part it works, but when I add verifying lines it doesn't work and can't find the button to click. Then I use Explicit Waits but it can't define the name "element". I'm confused. Here's the code: from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Firefox() driver

How to extract the text from the “Health” Element

房东的猫 提交于 2019-12-13 16:58:17
问题 I've been trying for hours to find the correct link to use in selenium for the HP value of this game. To check yourself, I'll provide a user & password as belowed: Website : https://s3-en.bitefight.gameforge.com/user/login Username: testaccount111 Password: python123 I've tried health = driver.find_elements_by_xpath("//div[2]/div/div[1]/text()[5]") but it gives errors. 回答1: As per the website https://s3-en.bitefight.gameforge.com/user/login to extract the text from Health element i.e. 8.460 /

How to click a link within youtube comment using an user agent through Selenium and Python

廉价感情. 提交于 2019-12-13 16:24:34
问题 I am writing a script that clicks a link in the youtube comment, it works fine, but when I combine it with the user agent it doesn't work, can someone help me? example : link Html : <a class="yt-simple-endpoint style-scope yt-formatted-string" spellcheck="false" href="/redirect?redir_token=ix1uBK3TO3bxXdcT7EvDFp-vI9p8MTU0NjQxNTExOEAxNTQ2MzI4NzE4&event=comments&q=https%3A%2F%2Fjulissars.itworks.com%2F&stzid=Ugw6ip_QkzwyJPIq3bp4AaABAg" rel="nofollow">https://julissars.itworks.com</a> Code

How to validate html5 constraint validation message using Selenium-Webdriver and Java

房东的猫 提交于 2019-12-13 03:51:12
问题 How do I validate the following message? The required class has the floating message.: try the following, but I get the error "no such alert" package firsttestngpackage; import org.openqa.selenium.Alert; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.Assert;

selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable when clicking on an element using Selenium Python

萝らか妹 提交于 2019-12-13 03:12:52
问题 I understand this question has been asked but I need some solution for this error: Traceback (most recent call last): File "goeventz_automation.py", line 405, in <module> if login(driver) is not None: File "goeventz_automation.py", line 149, in login WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@track-element='header-login']"))).click() File "/usr/local/lib/python3.6/dist-packages/selenium/webdriver/support/wait.py", line 80, in until raise TimeoutException

How to click on a <svg:image> element using Selenium and Python

旧巷老猫 提交于 2019-12-13 00:27:02
问题 Provided an xpath below: <svg:image xlink:href="some.svg" class="holder-38" width="24" height="268" preserveAspectRatio="none" x="426.7" y="473" type="image/svg+xml" data-ember-action="" data-ember-action-12238="12238"> I am able to access this with xpath (without tag as '*'): '//*[@class="holder-38"]' But unable to access with tag as svg:image : '//svg:image[@class="holder-38"]' How can I specify the tag here? 回答1: <svg:image> The <svg:image> element includes images inside SVG documents. It

How to wait for invisibility of an element through PageFactory using Selenium and Java

て烟熏妆下的殇ゞ 提交于 2019-12-12 19:25:32
问题 Is there a way to wait for an element not present in Selenium using PageFactory annotations? When using: @FindBy(css= '#loading-content') WebElement pleaseWait; to locate the element, and then: wait.until(ExpectedConditions.invisibilityOfElementLocated(pleaseWait)); I would get: org.opeqa.selenium.WebElement cannot be converted to org.openqa.selenium.By I am able to do what I need by using: wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector('loading-content'))); However

java.io.IOException: Connection was aborted by the software in your host machine with Sendkey() in selenium java

为君一笑 提交于 2019-12-12 17:39:10
问题 OS: Win7 64bit Browser:Chrome I'm working on my assignment to test a program with selenium. I'm using the code provided by the professor,which creates a web-app on my localhost:8080 (So there shouldn't be any connection problem) public void canConenctTwoPlayers() { // connect //2: missing code this.indexPage.connect.click(); assertThat(this.indexPage.hasText("Successfully connected to the game with unique "), is(true)); this.indexPage.numberPlayers.click(); this.indexPage.numberPlayers

Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node

我怕爱的太早我们不能终老 提交于 2019-12-11 23:51:42
问题 I have a dialog box appearing on my page every time I open it. I want to close it so that I can proceed with my programming. The dialogue box is like this image I tried the following code : wait.until(ExpectedConditions.presenceOfElementLocated(By.cssSelector("div#psyma_layer_background div#psyma_header div#psyma_close_link_container div#psyma_close_link a#psyma_close_button_link"))); wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("div#psyma_layer_background div#psyma