selenium-webdriver

Appium. Mobile App Automation. Wait until

霸气de小男生 提交于 2021-01-28 02:16:26
问题 Friends, please help! I don't know how to do "wait.until". I'm using Appium with UIAutomator. My test would wait until new app's page will loaded and 'Text 1' in text field will be checked. I have such parameters in UIAutomator: text : Text 1; recource-id: payment_content_title; class: android.widget.TextView; package: ru.mts.stm.mobilemts; IntelliJ says that my code is incorrect: WebDriverWait wait; wait = new WebDriverWait(driver, 60); wait.until(ExpectedConditions.textToBe(new MobileBy

Selenium Python Using find elements how do i get the text value of each element

非 Y 不嫁゛ 提交于 2021-01-27 23:43:58
问题 I am using Selenium Webdriver with Python. I have a search results page which displays a list of products. I want to loop through the list and print out the text value of the h2 tag. E.g. it should print out F1 2015 (PS4) I know i should use self.driver_find_elements to get all the elements into a list. I should then use a for loop to iterate through and print out it's value. My code is not working. It prints out a list of the representation of the object. It does not print out F1 2015 (PS4)

How do you set network throttling in selenium using javascript?

喜你入骨 提交于 2021-01-27 23:41:21
问题 How do you set the network throttling settings in chrome using selenium and javascript 回答1: It did take me a bit of time to figure this out as well, but this seemed to work for me driver = await new Builder() .forBrowser(engine) .usingServer(testConfig.seleniumServer + 'wd/hub') .setChromeOptions(new chrome.Options()) //.headless() .build(); driver.setNetworkConditions({ offline: false, latency: 15, // Additional latency (ms). download_throughput: 50 * 1024, // Maximal aggregated download

How to extract the text of the firstselectedoption from a dropdown using Selenium Webdriver through Java

半城伤御伤魂 提交于 2021-01-27 22:10:50
问题 After selecting an option from drop-down. I am trying to get that option displayed in the console. below is my code. But I get "//[[[[ChromeDriver: chrome on WINDOWS (d5a01776981da5dacfeb89dbbc2e6b52)] -> xpath: //*[@name='airline']]].// -> tag name: option]" The tag name is option for dropdown options. I have tried all solutions of selectByXXXX. but nothing seems to work. what would be the right code ? //airline preference { Select airline = new Select (driver.find Element(By.name("airline")

unable to use sendKeys“sendKeys(CharSequence[]) in the type WebElement is not applicable for the arguments (String)”

北城以北 提交于 2021-01-27 21:10:49
问题 I am trying to send "String" as argument in sendKeys method [type WebElement] but system is using it as char sequence, so I am not getting proper output. public static void setGridDropDownValue(Selenium selenium, WebDriver webDriver, String strGridId, int nRowIndex, int nCellIndex, String strValue) { String strXPath = "//div[@id='"+strGridId+"']//table/tbody/tr[2]/td/div/div/table/tbody/tr["+(nRowIndex+2)+"]/td["+(nCellIndex+1)+"]/"; selenium.click(strXPath); selenium.doubleClick(strXPath);

How to get the length of the <li> elements in an <ol> with Selenium in Python?

你离开我真会死。 提交于 2021-01-27 20:22:40
问题 I have an <ol> list in my HTML like the following: <ol id="search-results"> <li class="foo">-</li> <li class="foo">-</li> <li class="foo">-</li> <li class="foo">-</li> </ol> What I need to do is to verify that the <ol> list contains <li> items within, ie. a search query comes up with actual results. My current code is as follows: search_field = driver.find_element(By.NAME, 'query') search_field.send_keys('Foo') search_field.submit() results_list = driver.find_element(By.ID, 'search-results')

Selenium GeckoDriver is slow to launch Firefox Browser

心已入冬 提交于 2021-01-27 20:18:08
问题 I have recently been trying to get a Selenium environment up and running again. Everything works as it should with scripts executing as they should, using different web drivers etc etc. However, the initial launch of each driver takes anywhere between 2-5 min to launch. This makes it a pain to develop and troubleshoot my scripts. I use Python 3.6 with PyCharm and Selenium installed with pip. The same issue is present with Python 2.7. Things I have tried so far (without success): Reinstalled

Selenium: access denied

眉间皱痕 提交于 2021-01-27 19:00:31
问题 I am trying to scrape some data from LV website with Selenium and keep getting 'Access Denied' screen once 'sign in' button clicked. I feel like there is a protection against this because all seems to be working fine when I do the same manually. Oddly, I need to click 'sign in' button twice to be able to sign in manually. My code: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver

SyntaxError: invalid syntax while using find_element_by_xpath using Selenium in Python

余生颓废 提交于 2021-01-27 18:53:27
问题 Code Trials: from selenium import webdriver driver = webdriver.Firefox() driver.get("http://www.niftyindices.com/reports/historical-data") driver.maximize_window() driver.find_element_by_xpath("//*[@id="ddlHistorical"]").send_keys("NIFTY 100") I am getting an error: File "<ipython-input-32-592f058980cd>", line 5 driver.find_element_by_xpath("//*[@id="ddlHistorical"]").send_keys("NIFTY 100") ^ SyntaxError: invalid syntax 回答1: This error message... SyntaxError: invalid syntax ...implies that

Selenium: Click on a “<div><a></a></div>” button

空扰寡人 提交于 2021-01-27 18:18:33
问题 I tried to click on a button. It has this structure: <div class="button-wrapper" id="button-verify-wrapper"> <a x-ng-click="verifySfdcConnection()" class="clearfix float-left button-green"> <div class="icon-green icon-green-verify"></div> <div class="button-label ng-binding">Verify Connection</div> </a> <div x-ng-class="{'connection-verified':wizardData.inputSource.sfdc.connectionStatus}" x-ng-show="wizardData.inputSource.sfdc.connectionStatus" style="" class="connection-verified"></div> <