selenium

How to upload a file by transfering the file from the local machine to the remote web server using Selenium Grid

时光毁灭记忆、已成空白 提交于 2021-02-05 08:16:08
问题 File Upload with a Selenium Grid: Code import java.net.MalformedURLException; import java.net.URL; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.LocalFileDetector; import org.openqa.selenium.remote.RemoteWebDriver; public class Main { public static void main(String[] args) throws MalformedURLException { DesiredCapabilities capabilities =

Getting error exception in thread “main” java.lang.NullPointerException

回眸只為那壹抹淺笑 提交于 2021-02-05 08:15:48
问题 When i run the following class files in selenium, the browser is launched and URL is opened but error after that: exception in thread "main" java.lang.NullPointerException at guru99project.guru99project.printtitlepage(guru99project.java:25) at guru99project.Main_method.main(Main_method.java:10) Code trials: package guru99project; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa

Getting error exception in thread “main” java.lang.NullPointerException

偶尔善良 提交于 2021-02-05 08:15:46
问题 When i run the following class files in selenium, the browser is launched and URL is opened but error after that: exception in thread "main" java.lang.NullPointerException at guru99project.guru99project.printtitlepage(guru99project.java:25) at guru99project.Main_method.main(Main_method.java:10) Code trials: package guru99project; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa

WebDriver with Java - Not able to get all the text using Webdriver

不问归期 提交于 2021-02-05 08:15:28
问题 I'm not able to get all the text on this website - https://niftygateway.com/marketplace Using this simple code - String iterativeXpath = "(//*[@id='root']/div/div[2]/div[2]/div/div[2]/div[2]/div[1]/div/div)"; iterativeXpath = iterativeXpath.substring(0, iterativeXpath.length()-1); WebDriverWait wait = new WebDriverWait(driver, 15); for(int i = 1; i <=20; i++){ wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(iterativeXpath+"["+i+"])"))); System.out.println(driver.findElement

How to select an option from the dropdown menu using Selenium and Python

倾然丶 夕夏残阳落幕 提交于 2021-02-05 08:12:26
问题 I am trying to get the fares for all combinations of stations in Metro-North using Selenium in Python. I wanted to go to their fare page, put station names into the select fields, click on the fare button, and then copy the needed values to the dataframe. I tried all possible options to select stations from the dropdown menu but nothing works as I get the error: ElementNotInteractableException . The code I tried: driver = webdriver.Safari() driver.get('http://as0.mta.info/mnr/schedules/sched

How to select an option from the dropdown menu using Selenium and Python

折月煮酒 提交于 2021-02-05 08:12:08
问题 I am trying to get the fares for all combinations of stations in Metro-North using Selenium in Python. I wanted to go to their fare page, put station names into the select fields, click on the fare button, and then copy the needed values to the dataframe. I tried all possible options to select stations from the dropdown menu but nothing works as I get the error: ElementNotInteractableException . The code I tried: driver = webdriver.Safari() driver.get('http://as0.mta.info/mnr/schedules/sched

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

北城余情 提交于 2021-02-05 08:12:05
问题 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

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)

selenium.common.exceptions.WebDriverException: Message: Failed to convert data to an object while trying to click an element with Selenium and Python

a 夏天 提交于 2021-02-05 08:09:59
问题 im trying to click a button on a page after logging in the button is the following HTML <div id="carrierDashboardControls"> <button class="yms-button-primary" ng-click="refresh()"> <t>Refresh</t> </button> <button class="yms-button-primary-alt ng-isolate-scope" ng-csv="fetchData()" lazy-load="true" csv-header="getCsvHeader" filename="carrier-dashboard.csv" field-separator=",">CSV </button> </div> there are 2 buttons in this and i want to click the one with class "yms-button-primary-alt ng