selenium-webdriver

How to click on a search engine result if it matches the searched value

試著忘記壹切 提交于 2020-04-30 06:49:26
问题 I'm new to selenium. I'm taking user input and based on that, I'm searching it in duckduckgo. I want, if the input value matches the search result weblink, the code should click on that matched website. My code executes successfully but it doesn't click on the weblink. This is my code:- from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.support.ui import WebDriverWait from selenium.common.exceptions import NoSuchElementException,

Python/Selenium - how to loop through hrefs in <li>?

我怕爱的太早我们不能终老 提交于 2020-04-30 04:22:07
问题 Web URL: https://www.ipsos.com/en-us/knowledge/society/covid19-research-in-uncertain-times Hi folks, I want to parse the HTML as below: I want to get all hrefs within the < li > elements and the highlighted text. I tried the code elementList = driver.find_element_by_class_name('block-wysiwyg').find_elements_by_tag_name("li") for i in range(len(elementList)): driver.find_element_by_class_name('blcokwysiwyg').find_elements_by_tag_name("li").get_attribute("href") But the block returned none. Can

How to reach the end of a scroll bar in appium?

那年仲夏 提交于 2020-04-28 20:41:47
问题 I'm trying to automate scrolling of a horizontal bar,where the elements of the bar are dynamic and are getting fetched from an API. Is there a way to automate it in appium? 回答1: If you have any element or text in the bottom of page then you can use UiAutomator2. add in desired capability 'UiAutomator2' if you are using appium. capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "UiAutomator2"); Now use below functions if you have element's id public void scrollByID(String Id, int

Selenium - wait until element is present, visible and interactable

99封情书 提交于 2020-04-28 07:55:20
问题 I have a selenium script (python) that clicks a reply button to make the class anonemail appear. The time it takes for the class anonemail to appear varies. Because of that I have to use sleep until the element has appeared. I want to wait until the class has appeared instead of using sleep. I have heard about wait commands, but I don't know how to use them. This is what I have thus far: browser.find_element_by_css_selector(".reply-button").click() sleep(5) email=browser.find_element_by_css

Selenium - wait until element is present, visible and interactable

房东的猫 提交于 2020-04-28 07:54:16
问题 I have a selenium script (python) that clicks a reply button to make the class anonemail appear. The time it takes for the class anonemail to appear varies. Because of that I have to use sleep until the element has appeared. I want to wait until the class has appeared instead of using sleep. I have heard about wait commands, but I don't know how to use them. This is what I have thus far: browser.find_element_by_css_selector(".reply-button").click() sleep(5) email=browser.find_element_by_css

Clicking on Get Data button for Monthly Settlement Statistics on nseindia.com doesn't fetch results using Selenium and Python

血红的双手。 提交于 2020-04-24 05:51:32
问题 I am trying to scrape data from here. By clicking on the capital market and 2019-20 year. I want to click on Get data. I have used following code: driver = webdriver.Chrome(executable_path=chrome_path,options=chrome_options) driver.get( nse_cash_keystats_page ) driver.find_element_by_xpath( "//select[@id='h_filetype']/option[text()='Capital Market ']" ).click() driver.find_element_by_xpath( "//select[@id='yearField']/option[text()='2019-2020']" ).click() downloadButton=WebDriverWait(driver,20

Clicking on Get Data button for Monthly Settlement Statistics on nseindia.com doesn't fetch results using Selenium and Python

感情迁移 提交于 2020-04-24 05:49:27
问题 I am trying to scrape data from here. By clicking on the capital market and 2019-20 year. I want to click on Get data. I have used following code: driver = webdriver.Chrome(executable_path=chrome_path,options=chrome_options) driver.get( nse_cash_keystats_page ) driver.find_element_by_xpath( "//select[@id='h_filetype']/option[text()='Capital Market ']" ).click() driver.find_element_by_xpath( "//select[@id='yearField']/option[text()='2019-2020']" ).click() downloadButton=WebDriverWait(driver,20

How to Scroll web page to the target element using selenium

旧时模样 提交于 2020-04-18 05:47:54
问题 I want to scroll to an element in selenium, but I want it to be at the top of the page, not just visible on the page. How can I make it so that the page scrolls such that the element being scrolled to is at the top of the browser? target = browser.find_element_by_css_selector(".answers-wrap") actions = ActionChains(browser) actions.move_to_element(target) actions.perform() 回答1: Here is example using this page we are on To scroll the web page by 1000 pixel vertical use execute_script("window

How to Login to WebEx Platform with Selenium

时光毁灭记忆、已成空白 提交于 2020-04-18 05:45:43
问题 I can't login to the WebEx Platform, and I need to be able to login to WebEx to scrape the meetings scheduled for the week. I keep getting tracebacks, but I can't even send.keys() methods to the perspective login form on the login container. The main thing is I am having an issue with just autneticating. I need to be able to login to be able to parse and see the current weeks schedule. You can see the code here: https://github.com/Richard-Barrett/ITAdminInfra/blob/master/Integrations/WebEx

SyntaxError: invalid syntax with executable_path in ipython

99封情书 提交于 2020-04-18 03:50:26
问题 I am using selenium web driver for an assignment in Python. I am getting a syntax error. I am using google colab and Python 3. Here is my code import time from selenium import webdriver driver = webdriver.Chrome (r "C:\Users\Anisha\Downloads\chromedriver.exe") time.sleep(20) I am getting error File "<ipython-input-28-7654fa692ce2>", line 1 driver = webdriver.Chrome (r "C:\Users\Anisha\Downloads\chromedriver.exe") ^ SyntaxError: invalid syntax Please help I am not getting where I am wrong. 回答1