selenium-webdriver

Unable to fit the two expressions into my script

醉酒当歌 提交于 2020-01-17 08:04:09
问题 I've written a script to scrape documents from a web page using python in combination with selenium. However, the only thing I got stuck is print the value. As selenium doesn't support indexing in text, I can't think further to accomplish this. Taking a look into my code You will get to know what I meant. I've commented out the two lines to be rectified. Thanks in advance. Here is what I've written so far: from selenium import webdriver import time driver = webdriver.Chrome() driver.get(

How to check if the button is clickable using selenium webdriver

不打扰是莪最后的温柔 提交于 2020-01-17 07:08:33
问题 I am trying to find if the button element is clickable which I am not able to validate successfully using selenium webdriver. Here is my code to validate if the element is clickable boolean installAFile; String classValues = driver.findElement(by.XPATH("//button[contains(., 'Install a new file')]")).getAttribute("class"); installAFIle = classValues.contains("iconbutton-button--clickable"); return installAFIle; Here is the HTML <div> <!-- react-text: 406 --> test message 1 <!-- /react-text -->

If there is a expected value in the table then I want to select the hyperlink that exists in 0th index of the row using Selenium WebDriver

会有一股神秘感。 提交于 2020-01-17 06:38:21
问题 I have a table in my webpage as attached in the diagram attached. I want to select the Hyperlink existing in 0th index of the table row if my expected value is there in that particular row. How can I implement this in Selenium WebDriver using Java? enter image description here 回答1: You can try following code for the same: List <WebElement> rowElements = driver.findElements(By.xpath("\\table\\tr")); for(int i=1; i< rowElements.size(); i++){ List <WebElement> colElements = rowElements.get(i)

Selenium internal id of element don't change when ajax executed

百般思念 提交于 2020-01-17 05:48:06
问题 I use this great solution for waiting until the page loads completely. But for one page it's don't work: from selenium import webdriver driver = webdriver.FireFox() driver.get("https://vodafone.taleo.net/careersection/2a/jobsearch.ftl") element = driver.find_element_by_xpath(".//*[@id='currentPageInfo']") print element.id, element.text driver.find_element_by_xpath(".//a[@id='next']").click() element = driver.find_element_by_xpath(".//*[@id='currentPageInfo']") print element.id, element.text

Not able to click Button(element) on Selenium webdriver

╄→尐↘猪︶ㄣ 提交于 2020-01-17 05:22:19
问题 Not able to click Button(element) on Selenium webdriver. It's showing no such element exception. HTML: <button id="datepicker-354-7412-title" class="btn btn-default btn-sm uib-title" tabindex="-1" ng-disabled="datepickerMode === maxMode" ng-click="toggleMode()" type="button" aria-atomic="true" aria-live="assertive" role="heading"> <strong class="ng-binding">August 2016</strong> </button> Java: driver.findElement(By.xpath("//*[@id='flip-card']/div[2]/div/div[2]/div[2]/div[1]/div/div[2]/i"))

Python WebDriver AttributeError: LoginPage instance has no attribute 'driver'

别等时光非礼了梦想. 提交于 2020-01-17 05:19:17
问题 I have read a few tutorials on Python Selenium Webdriver Page Object model as I have to automate the gui tests using Selenium with Python. To start off with I am trying to write a Login Page class and a LoginMainTest class. I am getting the following error when i run the code. AttributeError: LoginPage instance has no attribute 'driver' I think i have to specify the selenium driver where i instantiate the LoginPage e.g. on this line log_in = LoginPage.LoginPage() I need some help please. Full

Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver?

大憨熊 提交于 2020-01-17 04:03:08
问题 Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver ? 回答1: Any other way is only to use native Javascript action to enter the value in the text box: WebDriver driver = new FirefoxDriver(); JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("document.getElementById("textbox_id").value='new value';); 回答2: @Vasntha, try mine code its tested one driver.get("http://www.qajudge.com/"); WebElement cssValue= driver.findElement(By

Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver?

巧了我就是萌 提交于 2020-01-17 04:03:07
问题 Is there any other way(not sendKeys) to enter text into textbox using selenium webdriver ? 回答1: Any other way is only to use native Javascript action to enter the value in the text box: WebDriver driver = new FirefoxDriver(); JavascriptExecutor executor = (JavascriptExecutor)driver; executor.executeScript("document.getElementById("textbox_id").value='new value';); 回答2: @Vasntha, try mine code its tested one driver.get("http://www.qajudge.com/"); WebElement cssValue= driver.findElement(By

I want to run the selenium webdriver code without using the eclipse is that possible?

本秂侑毒 提交于 2020-01-17 03:52:05
问题 I want to run the selenium webdriver code without using the eclipse is that possible if its yes please explains how it can be achieved. 回答1: You can run through command line interface: java -classpath "selenium-server-standalone-2.33.0.jar" SeleniumWebDriverExample.java If you have the jar file in different location , give the absolute / relative location of the classpath. 来源: https://stackoverflow.com/questions/25058790/i-want-to-run-the-selenium-webdriver-code-without-using-the-eclipse-is

Handling Drop down from database using selenium

北战南征 提交于 2020-01-16 19:39:48
问题 How to handle drop down field data which comes from database using selenium. A form contains 2 drop down fields and one is having HTML data and it is handled perfectly. Data to the 2nd drop down comes as per the selection from the 1st which comes from database. Need guides to complete the action. 来源: https://stackoverflow.com/questions/59541955/handling-drop-down-from-database-using-selenium