selenium

How to get the total number of elements in a HTML with Selenium WebDriver and Autohotkey?

别等时光非礼了梦想. 提交于 2021-02-19 11:00:52
问题 I am trying to get the total number of items in an HTML page by a given class. I am using Selenium and Autohotkey to do it I've searched a lot of this topic but haven't found my particular solution Most of suggestions and answers I researched included solutions but for Java or other language, not for Autohotkey (Although they have similar structures in this case) Using this code to work with: <html> <body> <div id="pancakes"> <button class="button">Blueberry</button><br><br> <button class=

How to get the total number of elements in a HTML with Selenium WebDriver and Autohotkey?

℡╲_俬逩灬. 提交于 2021-02-19 11:00:39
问题 I am trying to get the total number of items in an HTML page by a given class. I am using Selenium and Autohotkey to do it I've searched a lot of this topic but haven't found my particular solution Most of suggestions and answers I researched included solutions but for Java or other language, not for Autohotkey (Although they have similar structures in this case) Using this code to work with: <html> <body> <div id="pancakes"> <button class="button">Blueberry</button><br><br> <button class=

Chrome profile not loading with selenium

与世无争的帅哥 提交于 2021-02-19 08:18:27
问题 Here's my code: from selenium import webdriver options = webdriver.ChromeOptions() options.add_argument(r"user-data-dir=C:\Users\shahr\AppData\Local\Google\Chrome\User Data\Profile 1") #Path to your chrome profile w = webdriver.Chrome(executable_path=r"C:\Program Files (x86)\chromedriver.exe", options=options) I tried this from other StackOverFlow Answers, but it refuses to open the desired profile 回答1: chrom_options.add_argument("user-data-dir=C:\\Users\robert.car\\AppData\\Local\\Google\

ReCaptcha download audio file?

微笑、不失礼 提交于 2021-02-19 07:53:03
问题 Please let me know of what I'm doing wrong Using the code from: How to interact with the reCAPTCHA audio element using Selenium and Python I want next to get the src file for the audio to download it, so I wrote exactly after the end of the provided code the following: # get the mp3 audio file src = driver.find_element_by_id("audio-source").get_attribute("src") But Python returns run time error saying: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to

Selenium problems with PDF download in Firefox

…衆ロ難τιáo~ 提交于 2021-02-19 07:15:27
问题 I'm working on an upgrade of our internal Java Selenium framework to the latest version 3.14.0 in combination with Firefox 61.0 and Geckodriver 0.21.0. I face problems when it comes to an automated download of a PDF file with Firefox. For example at this link there is a download button where I can let selenium perform a click on. Instead of downloading the pdf, a built-in viewer will be opened. The preference pdfjs.disabled should deactivate the viewer so created the driver instance with a

How to determine if a page is loaded using selenium?

心已入冬 提交于 2021-02-19 07:14:12
问题 I am interacting with a database that returns the newspaper reports about a event using selenium. Every time I implement a search query, the database opens a new page and starts to load all newspaper reports about the event. The webpage has an element that reports the total number of relevant reports found. The number changes before the page is fully loaded. My question is there a way to determine if the page is loaded. My current strategy is to check the number of total reports in a loop and

How to determine if a page is loaded using selenium?

时间秒杀一切 提交于 2021-02-19 07:07:23
问题 I am interacting with a database that returns the newspaper reports about a event using selenium. Every time I implement a search query, the database opens a new page and starts to load all newspaper reports about the event. The webpage has an element that reports the total number of relevant reports found. The number changes before the page is fully loaded. My question is there a way to determine if the page is loaded. My current strategy is to check the number of total reports in a loop and

how to get list of browser installed in a system using python?

≡放荡痞女 提交于 2021-02-19 07:06:43
问题 I would like to write a script (in python) which scans the machine.(assumption is system has Linux) and retrieve the list of browser's installed. Looking for suggestions to implement it. I am using selenium to open links browser = webdriver.Firefox() Here we have to mention Firefox to open link in Firefox browser. What if user don't have Firefox in machine (chrome installed)? I had already searched but haven't got any result. P.S: If system has windows/Mac OS 回答1: A better approach: use try

how to get list of browser installed in a system using python?

流过昼夜 提交于 2021-02-19 07:05:34
问题 I would like to write a script (in python) which scans the machine.(assumption is system has Linux) and retrieve the list of browser's installed. Looking for suggestions to implement it. I am using selenium to open links browser = webdriver.Firefox() Here we have to mention Firefox to open link in Firefox browser. What if user don't have Firefox in machine (chrome installed)? I had already searched but haven't got any result. P.S: If system has windows/Mac OS 回答1: A better approach: use try

Find texts that contains quotation marks by xpath in Selenium

♀尐吖头ヾ 提交于 2021-02-19 06:28:21
问题 I just got an error in Selenium(Java): Unable to locate an element with the xpath expression //*[contains(.,'The field SomeField must be a string or array type with a maximum length of '60'.')] Apparently, there are two ' which broke the expression. So I changed the code from WebElement elem = findElement(By.xpath("//*[contains(.,'" + arg + "')]")); to WebElement elem = findElement(By.xpath("//*[contains(.,'" + arg.toString().replace("'", "\'") + "')]")); WebElement elem = findElement(By