selenium-webdriver

Loop only works for elements in a screen not after scrolling

我的未来我决定 提交于 2021-01-29 07:18:22
问题 I have written a loop to get the links to all the products in Poshmark Closet. Now how Poshmark works is it shows 48 products and after that, we need to scroll to load the next products. Please check the following code. It only works for 48 products and after scrolling, it does not work on those products. The program ends without any error! def loop(): n = 0 container = driver.find_elements_by_css_selector('.tile.col-x12.col-l6.col-s8.p--2') links = [] while n < 20: # I used while loop to go

I need to have an gradle task to execute my cucumber runner class and execute cucumber tets

匆匆过客 提交于 2021-01-29 06:39:48
问题 I have my Cucumber Runner class as shown below and i need to call and run this runner class through gradle so that in turn it executes my stepdefinition / tests as we do it in normal cucumber project import java.io.File; import java.io.IOException; import org.apache.commons.io.FileUtils; import org.testng.annotations.AfterClass; import org.testng.annotations.BeforeSuite; import com.inspire.brands.helper.reporter.ReporterUtil; import io.cucumber.testng.AbstractTestNGCucumberTests; import io

Why chrome doesn't show save password or remember password option while running automation script?

坚强是说给别人听的谎言 提交于 2021-01-29 05:51:09
问题 While automating with selenium if a username and password is entered why doesn't chrome browser show the option to save credentials as it does in regular practice. 回答1: As mentioned in previous answer, new instance of WebDriver opens fresh browser window, without previous cookies etc. What could you do is: When you first start WebDriver and open login page, using selenium enter credentials, make sure you check "remember details" checkbox is present. Now once you are logged in, you can get

How do I extract data from dynamic updating webpages

徘徊边缘 提交于 2021-01-29 05:50:33
问题 I want to scrape the review from Sephora website. The review is dynamically updated. After inspection I found the review is here in the HTML code. <div class="css-eq4i08 " data-comp="Ellipsis Box">Honestly I never write reviews but this is a must if you have frizzy after even after straightening it! It smells fantastic and it works wonders definitely will be restocking once I’m done this one !!</div> I want to write a python selenium code to read the review. The code I wrote is here... from

java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder;

拟墨画扇 提交于 2021-01-29 05:30:28
问题 When I try to create a RemoteWebDriver in 3.11, I see this error below. This worked fine up through 3.10. I've reverted to 3.10 for now. I tried adding in the gson jar from google, but I still see same error. Anyone else see this? I'm running one selenium server as hub, and then running a node against it with webdriver for ff or chrome, same issue. com.google.gson.GsonBuilder.setLenient()Lcom/google/gson/GsonBuilder; java.lang.NoSuchMethodError: com.google.gson.GsonBuilder.setLenient()Lcom

How to click a link by text with No Text in Python

|▌冷眼眸甩不掉的悲伤 提交于 2021-01-29 05:30:27
问题 I am trying to scrape a Wine data from vivino.com and using selenium to automate it and scrape as many data as possible. My code looks like this: import time from selenium import webdriver browser = webdriver.Chrome('C:\Program Files (x86)\chromedriver.exe') browser.get('https://www.vivino.com/explore?e=eJwFwbEOQDAUBdC_uaNoMN7NZhQLEXmqmiZaUk3x987xkVXRwLtAVcLLy7qE_tiN0Bz6FhcV7M4s0ZkkB86VUZIL9l4kmyjW4ORmbo0nTTPVDxlkGvg%3D&cart_item_source=nav-explore') # Vivino Website with 5 wines for now

TestNG Parallel Testing, Opens two browsers but runs all tests only in 1 browser

丶灬走出姿态 提交于 2021-01-29 05:11:31
问题 When I run this code, first it opens two Browsers ( Chrome ) and goes to the base URL. But here is the confusing part for me. When the browsers are open, out of these two browsers, only one browser will receive test commands. In my cases, I am running one class and this class has two test cases. but all of the test cases will run in one browser. 2nd browser just open and goes to the bases URL BASE CLASS : package com.cross.base; import io.github.bonigarcia.wdm.WebDriverManager; import org

Return html code of dynamic page using selenium

偶尔善良 提交于 2021-01-29 03:10:16
问题 I'm trying to crawl this website, problem is it's dynamically loaded. Basically I want what I can see from the browser console, not what I see when I right click > show sources. I've tried some selenium examples but I can't get what I need. The code below uses selenium and get only what you get in right click -> show code. How can I get the content of the loaded page? from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC from

Open Application (such as zoom.us) with Selenium Webdriver

核能气质少年 提交于 2021-01-29 02:20:55
问题 I want to be able to use pure selenium webdriver to open a zoom link in Chrome and then redirect me to the zoom.us application. When I execute this: from selenium import webdriver def main(): driver = webdriver.Chrome() driver.get("https://zoom.us/j/000-000-000") main() I receive a pop-up saying https://zoom.us wants to open this application. and I must press a button titled open zoom.us to open the app. Is there a way to press this pop-up button through selenium. Or, is there some other way

Why does Selenium get the child elements slowly

可紊 提交于 2021-01-29 02:13:21
问题 For example, HTML: <input type="hidden" name="ie" value="utf-8"> this element don't have child element, when I use code: List<WebElement> childElements = ele.findElements(By.xpath("./*")); the program uses a very long time (about 30s) return a result. And the result size is right which is zero. So how can I resolve this problem? Thanks. 回答1: As per the documentation findElements() method is affected by the implicit wait duration in force at the time of execution. When implicitly waiting,