selenium-webdriver

AppiumDriver gives null pointer exception

独自空忆成欢 提交于 2020-01-22 02:12:45
问题 In my appium + testng app, what I have put is: package com.tribehr.ios.ios_test; import java.net.URL; import io.appium.java_client.AppiumDriver; import org.junit.After; import org.junit.Before; import org.openqa.selenium.*; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.testng.annotations.Test; import org.testng.Assert; public class NewTest { private AppiumDriver driver; @Before public void setUp() throws Exception { // set

scrollintoview is not scrolling to element (python)

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-22 01:54:45
问题 I am parsing the HTML of a website and I want selenium to scroll down to all the elements containing '5 days ago'. This is the code I have: element = driver.find_elements_by_xpath(u"//*[contains(text(), '5 days ago')]") for e in element: driver.execute_script("arguments[0].scrollIntoView();", element) time.sleep(SCROLL_PAUSE_TIME) if element=='5 days ago': break It is not scrolling. Can someone help me with what I am doing wrong? Thanks 来源: https://stackoverflow.com/questions/54308539

How to scroll UP to an element and click in selenium?

风流意气都作罢 提交于 2020-01-22 00:38:31
问题 I have a scenario where system needs to scroll UP to the webelement in the left panel of the page and click to perform other operations.I have tried the below ways but none of them are working.Please suggest : 1. WebElement element = driver.findElement(By.xpath("element")); ((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView(true);", element); Thread.sleep(500); 2. WebElement element = driver.findElement(By.xpath("element")); Actions actions = new Actions(driver); actions

Session not created Selenium/webdriver when using Safari 12

陌路散爱 提交于 2020-01-22 00:03:26
问题 Since upgrading to Safari 12, my automated scripts are now getting this error: SessionNotCreatedError: Request body does not contain required parameter 'capabilities'. (The error does not occur for other browsers). I'm using the javascript webdriver bindings and, when I build webdriver, I use the withCapability key value pairs: var capabs = { 'browserName' : 'Safari', 'version' : '12.0' } browserUnderTest = new webdriver.Builder(). withCapabilities(capabs) .forBrowser('safari') .build(); I

Session not created Selenium/webdriver when using Safari 12

左心房为你撑大大i 提交于 2020-01-22 00:02:16
问题 Since upgrading to Safari 12, my automated scripts are now getting this error: SessionNotCreatedError: Request body does not contain required parameter 'capabilities'. (The error does not occur for other browsers). I'm using the javascript webdriver bindings and, when I build webdriver, I use the withCapability key value pairs: var capabs = { 'browserName' : 'Safari', 'version' : '12.0' } browserUnderTest = new webdriver.Builder(). withCapabilities(capabs) .forBrowser('safari') .build(); I

Session not created Selenium/webdriver when using Safari 12

百般思念 提交于 2020-01-22 00:01:41
问题 Since upgrading to Safari 12, my automated scripts are now getting this error: SessionNotCreatedError: Request body does not contain required parameter 'capabilities'. (The error does not occur for other browsers). I'm using the javascript webdriver bindings and, when I build webdriver, I use the withCapability key value pairs: var capabs = { 'browserName' : 'Safari', 'version' : '12.0' } browserUnderTest = new webdriver.Builder(). withCapabilities(capabs) .forBrowser('safari') .build(); I

How to scroll in New tab in selenium

孤街醉人 提交于 2020-01-21 20:10:51
问题 I opened a new tab by clicking something in selenium in c #. I want to scroll after changing to a new tab, but I get a timeout error. I get a timeout message and no scroll. this is c# code. Used Chrome 79 Chrome option is options.AddArguments("handlesAlerts=false"); options.AddArguments("--disable-infobars"); options.AddArguments("--no-sandbox"); options.AddArguments("--disable-background-networking"); options.AddArguments("--disable-component-extensions-with-background-pages"); options

How to find element by part of its id name in selenium with python

こ雲淡風輕ζ 提交于 2020-01-21 19:17:08
问题 I'm using selenium with python,now I want to locate an element by part of its id name,what can I do? For example,now I've already located a item by id name coption5 : sixth_item = driver.find_element_by_id("coption5") Is there anyway I can locate this element only by using coption ? 回答1: To find the element which you have located with: sixth_item = driver.find_element_by_id("coption5") To locate this element only by using coption you can use can use either of the following Locator Strategies:

How to find element by part of its id name in selenium with python

回眸只為那壹抹淺笑 提交于 2020-01-21 19:16:52
问题 I'm using selenium with python,now I want to locate an element by part of its id name,what can I do? For example,now I've already located a item by id name coption5 : sixth_item = driver.find_element_by_id("coption5") Is there anyway I can locate this element only by using coption ? 回答1: To find the element which you have located with: sixth_item = driver.find_element_by_id("coption5") To locate this element only by using coption you can use can use either of the following Locator Strategies:

How to open Firefox Developer Edition through Selenium

試著忘記壹切 提交于 2020-01-21 14:37:53
问题 Following some tutorials on Selenium, I installed the geckodriver . In order to run a simple code on python to run Selenium, I have to specify this path in the command line: export PATH=$PATH:/home/xx/Downloads/geckodriver-v0.24.0-linux64 But I want Selenium to open the Developer edition I have as it contains the extension I want to test: When I sepcify the path for the Developer edition executable: export PATH=$PATH:/home/xx/Documents/ff_extension/firefox/ Then run my python script: from