r/SeleniumPython • u/armgonza • Mar 26 '23
Selenium Tutotial or Books to start
Hi Guys Could you recomend me a book(s) or tutorial to learn selenium, please?
Regards
r/SeleniumPython • u/armgonza • Mar 26 '23
Hi Guys Could you recomend me a book(s) or tutorial to learn selenium, please?
Regards
r/SeleniumPython • u/DaveDarell • Feb 21 '23
Hello all,
Currently I'm trying to get the direction of an animation with Selenium. The direction is either left or right. It depends on how the direction is whether I have to add or subtract a number and therefore I want to get the direction.
If somebody can give me an advice it would be very helpful :) Thanks!
r/SeleniumPython • u/[deleted] • Aug 10 '23
The open-source, low-code test automation platform Testsigma in April 2023, announced the release of their API testing feature which streamlines both the creation and execution of tests. The newest update allows users to create and manage API test assertions and data sets more efficiently!
Let’s have a detailed look at the new features introduced and what you can do with Testsigma’s..... (Read More)
r/SeleniumPython • u/QuietBlaze • Nov 27 '23
I can find innumerable tutorials; I don't want those.
I want to go to a web-based API reference for the Python selenium module (or whatever passes for that), where I can lookup, e.g., webdriver.Remote() and see every possible argument that can be passed to that method.
Can anyone point me in the correct direction?
Many thanks!
r/SeleniumPython • u/farhan1281 • Mar 09 '24
Hello, Reddit community,
I am new to learning selenium automation with Python, If someone is doing any project, I am willing to help them without any fee or money involved I want to learn and excel in automation.
Please reach out to me and provide me with your contact details I will contact you ASAP
r/SeleniumPython • u/Purple-Obligation357 • Feb 24 '24
I have very little experience working with selenium and cant figure out why shortcuts I'm trying to use aren't working. I know that there are multiple ways to do things I'm trying to do eg by executing js snippets, but I'm interested exactly what's wrong with keyboard keys.
Chrome version:122.0.6261.70 (Official Build) (64-bit)
Selenium version 4.18.1
Code:
This works correctly (simple text input):
from selenium import webdriver
from selenium.webdriver.common.by import By
import time
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
driver = webdriver.Chrome()
driver.get("https://google.com")
input_element = driver.find_element(By.CLASS_NAME, "gLFyf")
input_element.send_keys("test")
time.sleep(10)This also works fine (inserts "TEST"):
input_element.send_keys(Keys.SHIFT + "test")This does not work:
input_element = driver.find_element(By.CLASS_NAME, "gLFyf")
input_element.send_keys(Keys.CONTROL + "t") # t,j,w,r and other keysThis does not work
ActionChains(driver).key_down(Keys.CONTROL).send_keys("t").key_up(
Keys.CONTROL
).perform()This also does not work:
driver.find_element(By.TAG_NAME, "body").send_keys(Keys.CONTROL, "t")I also tried and it didn't help:
Changing selenium versions
Reinstalling selenium
Using different chrome profiles
Resetting chrome to default settings
ps Any help is appreciated, I spent hours searching for solution and didn't succeed
r/SeleniumPython • u/Apprehensive-Dirt419 • Oct 19 '23
Hello everyone , I am using Selenium Python to scrape a website https://www.whed.net/results_institutions.php
and This website contains data for every country(list of institutions) and one need to click on link of every instituion and scrape name , location and www associated with that institution.
Now I have tried to use selenium for automating the task and I am doing mostly fine other than being unable to close the dialog box.
This is my sample code. Can somebody Explain me how to do it.
service = Service("C:/Selenium_drivers/chromedriver-win64/chromedriver.exe")
driver = webdriver.Chrome(service=service)
driver.get(url)
country = 'Afghanistan'
institues = []
cities = []
wwws = []
drop_down = Select(driver.find_element(By.XPATH, '//select'))
drop_down.select_by_visible_text(country)
all_institute = driver.find_element(By.XPATH, "//input[@id='membre2']")
if not all_institute.is_selected():
all_institute.click()
button = driver.find_element(By.XPATH, "//input[@type='button']")
button.click()
results_per_page = Select(driver.find_element(By.XPATH, "//select[@name='nbr_ref_pge']"))
results_per_page.select_by_visible_text('100')
total_results = int(driver.find_element(By.XPATH, "//p[@class='infos']").text.split()[0])
max_iter = total_results//100 + 1
iterations = 0
go_on = True
while go_on:
iterations += 1
institutions = driver.find_elements(By.XPATH, "//li[contains(@class, 'clearfix plus')]")
for institue in institutions:
link = institute.find_element(By.XPATH, ".//h3/a")
link.click()
time.sleep(2)
pop_up = driver.find_element(By.XPATH, "//iframe[starts-with(@id, 'fancybox-frame')]")
driver.switch_to_frame(pop_up)
# main_window = driver.current_window_handle # Store the handle of the main window
# popup_window = None
# for window_handle in driver.window_handles:
# if window_handle != main_window:
# popup_window = window_handle
# Switch to the popup window
# driver.switch_to.window(popup_window)
institue = driver.find_element(By.XPATH, "//div[@class='detail_right']/div[1]").text
city = driver.find_element(By.XPATH, "//span[@class='libelle' and text() = 'City:']/following-sibling::span[@class='contenu']").text
www = driver.find_element(By.XPATH, "//span[@class='libelle' and text() = 'WWW:']/following-sibling::span[@class='contenu']").get_attribute("title")
institues.append(institute)
cities.append(city)
wwws.append(www)
close_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//a[@title='Close']")))
close_button.click()
# driver.switch_to.window(main_window)
# driver.switch_to.window(main_window)
if iterations >= max_iter:
go_on =False
break
time.sleep(2)
next_page = driver.find_elements(By.XPATH, "//a[@title='Next page' ]")[0]
next_page.click()r/SeleniumPython • u/buwaneka_H • Dec 11 '23
r/SeleniumPython • u/DMVTECHGUY • May 23 '24
Is it possible to keep the browser open during a loop . For example I have my script set up as a loop for function calling…let’s say the first run open browser is called…. Instead of it closing after opening it I want the script to loop back around and call another function eg. scroll down function.. I want all of this to happen on the same browser window. my issue is every time I’m able to get the browser to open up on the first run, but then as soon as I reached the beginning of the loop again it closes the browser that was open and reopens a new one instead of resuming on the same Ro I reached the beginning of the loop again it closes the browser that was open and reopens a new one instead of resuming on the same browser for the next action.
r/SeleniumPython • u/abionic • Mar 22 '24
r/SeleniumPython • u/fynnfisch • Jan 18 '24
Hey, have a Self written Python Ticket bot for Eventim. It worked for the last years. Since a week I get a err_http2_protocol_error on the webpage when using the bot. This happens on all Eventim websites. Does anyone know how to bypass and avoid that? Tried a lot, but nothing worked so far…
r/SeleniumPython • u/Tone866 • Mar 16 '24
I'm trying to save playlists from youtube music (not the music files, just a list which songs are in the playlist),
but it looks like I get invalid html, so selenium or other like html-simple-dom can't parse it.
A simple find_element never works, no meter which filter.
The same code, just on another website works without issues.
Are there some hacks how I could get it working?
Is there something known with youtube (music)?
Thanks!
EDIT: could solve it with BeautifulSoup
r/SeleniumPython • u/falcons_home • Jun 21 '23
Help me please I am unable to bypass this recaptcha
r/SeleniumPython • u/[deleted] • Jul 25 '23
r/SeleniumPython • u/elnath78 • Apr 07 '24
For some reason, Selenium is unable to scrape web pages from some domain, there must be some server side filtering going on, that prevents a simulated browser from accessing specific domains. Did anyone ever have a similar issue? How did you resolve?
r/SeleniumPython • u/Nirmitlamed • Jun 21 '23
Hi,
I don't know much about coding but i did managed to have a script in python of what i want with selenium in my mac with the help of ChatGPT and a lot of Youtube videos. here is the code:
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import time
s = Service('/usr/local/bin/chromedriver')
chromeOptions = Options()
chromeOptions.headless = False
driver = webdriver.Chrome(service=s, options=chromeOptions)
driver.get("https://www.example.com/meter-reading")
wait = WebDriverWait(driver, 10)
click_button = wait.until(EC.visibility_of_element_located((By.CLASS_NAME, "button.darkish-blue")))
click_button.click()
contract = driver.find_element(by=By.NAME, value="contractNumber")
contract.send_keys("323253")
contract = driver.find_element(by=By.NAME, value="deviceNumber")
contract.send_keys("454535")
wait = WebDriverWait(driver, 10)
button = driver.find_element(By.XPATH, '//*[@id="mat-dialog-0"]/app-meter-wizard/app-dialog-container/div/app-wizard-container/div/div/app-form-wizard/div/wizard-step[2]/div/app-dynamic-search-details/div/div[2]/form/div/app-button/button')
button.click()
time.sleep(3)
text = driver.find_element(By.XPATH, "/html/body").text
start_phrase = "reading"
end_phrase = "ending"
start_index = text.find(start_phrase) + len(start_phrase)
end_index = text.find(end_phrase)
if start_index != -1 and end_index != -1:
number_text = text[start_index:end_index].strip()
number = int(''.join(filter(str.isdigit, number_text)))
result = number + 7
print("Original number:", number)
print("Result after adding 7:", result)
else:
print("Number not found in the text")
meters_field = driver.find_element(by=By.NAME, value="meters")
meters_field.send_keys(str(result))
time.sleep(20)I want to take this script and run it on my Android phone. I was suggested to run it using Termux and was recommended to install these packages:
pkg install -y tur-repo x11-repo python-pip
pkg install -y chromium
pip install seleniumI am trying to figure out without any success how to set the webdriver correctly for Android.
I did find out that the webdriver in Termux is in this path: /data/data/com.termux/files/usr/bin/chromedriver
But still no luck in running it.
I have tried to look for some example but didn't find any.
Really hope someone can help me.
Thanks.
r/SeleniumPython • u/MouseDecent6676 • Dec 14 '22
Hello everyone. I’m having an issue with simple code with selenium-python.
import time from selenium import webdriver from selenium.webdriver.common.by import By driver = webdrvier.Chrome()
And that’s it, an empty chrome page automatically opens and in terminal there is error message: USB: usb_device_handle_win_cc 1045 Failed to read descriptor from node connection: A device attached to the system is not functioning.
Please help me out to solve the issue. 🙏🏻🙏🏻🙏🏻 OS windows 11. I’m new to selenium as well.
r/SeleniumPython • u/ZinjaC0der • Apr 07 '24
🚀 Exciting News! 🚀 The wait is over! BrowserBruter is now public and available for download, the world's first advanced browser-based automated web application penetration testing tool!
After in development for over a year, it is now officially released!
👉 Proof Of Concept - https://net-square.com/browserbruter/WhyWeNeedBrowserBruter/ 👉 Live Demonstration - https://youtube.com/playlist?list=PL1qH_bg_l1aMNDpCYSMXg83o-56vLdPS7&si=LtQxvbLDKWhiCsEC 📖 Explore the documentation: https://net-square.com/browserbruter/ 📥 Download now: https://github.com/netsquare/BrowserBruter/releases/tag/v2024.4-BrowserBruter
📈 BrowserBruter revolutionizes web application security testing by attacking web applications through controlled browsers, injecting malicious payloads into input fields. It automates the process of sending payloads to web application input fields in the browser and sending them to the server.
Highlighted Features:
🔐 Bypass Encrypted HTTP Traffic: Fuzz web application forms even when the HTTP body is encrypted, because it will fuzz web application before encryption takes place.
🤖 Bypass Captchas: Allows the pentester to manually perform human interactions to bypass captchas and proceed with payload insertions.
🖥️ Fuzz Front-Ends without HTTP Traffic: Can fuzz front-end elements even when there is no HTTP traffic.
🔗 Simplified Session Management: Removes the burden of session management, CSRF handling, and other micro-management tasks when using HTTP proxy tools, because these are managed by browser it self which is controlled by Browser Bruter.
📗 After fuzzing, BrowserBruter generates a comprehensive report that includes all the data and results of the penetration test, along with HTTP traffic. This report can be viewed using The Report Explorer tool, which comes bundled with BrowserBruter.
Handcrafted in India 🇮🇳
Behind the Scenes: The Backstory of BrowserBruter
🥷 As a penetration tester working on web application security VAPT projects, I faced a common challenge: the encryption of HTTP traffic was hindering my ability to fuzz input fields using traditional tools.
⚙️ Available tools like BurpSuite, SQLMap, etc. operate by modifying HTTP requests and responses. However, when encryption is implemented (not ssl, when the http request body's data is encrypted), the HTTP traffic becomes opaque to these tools, making it impossible to inject payloads into the web application's input fields.
💡 This limitation sparked an innovative idea: what if we could bypass the encryption and fuzz the web application at the browser layer instead of the HTTP layer? This approach would allow us to interact with the web application as if we were a user, bypassing the need to break the encryption of HTTP traffic.
The result? BrowserBruter, the world's first advanced browser-based automated web application penetration testing tool! By controlling browsers and injecting payloads into input fields, BrowserBruter bypasses encryption and automates the process of sending payloads to web application input fields in the browser.
This project is licensed under the GNU General Public License v3.0
r/SeleniumPython • u/Shot-Craft-650 • Sep 26 '23
I am trying to access this website: "www.realestate.com.au"
I can access it normally using my normal browser but I am not able to access it using:
Requests (I accessed it in the start but now it is causing issues Error Code: 429)
Selenium (It does not show anything. White blank page)
Undetected Chrome Driver (It does not show anything. White blank page)
Can anybody check this website and tell me how can I access it and get some data from it?
r/SeleniumPython • u/Havick-Gaming • Jul 17 '23
Hey everyone, newer coder here, and I have spent almost a month on and off between my bootcamp and free time trying to research Selenium. I am having a bit of trouble as my code works in its entirety but my speed at which I am finding an item seems to be off. Does anyone know how one would speed up the rate at which you check the page and then refresh, I am currently sitting at around 2 seconds on a simple web page. I just dont know if I missed something somewhere. I have set the driver wait and poll frequency low and setting them where they are got me from 5 seconds to 2 seconds....but thats as fast as it will go.
The program was built to log me into my school account each day at bootcamp so the program searches for the token code and if available, inputs the token into the text boss, if not, it refreshes the page.
Below is the code snippet from that last page...needless to say I am in a bootcamp and a few people built these programs, but I was the only one to go the selenium route...and I want mine to be the best lol.
Any help would be greatly appreciated!
def check_and_refresh():
try:
# Find the token element
token_element = WebDriverWait(driver, 0.01, poll_frequency=0.01).until(EC.presence_of_element_located((By.XPATH, "//span[contains(@class, 'tag is-danger')]")))
# Token element found, retrieve the token value
token = token_element.text
# Input the token into the text input box
input_box = driver.find_element(By.ID, "form-token")
input_box.clear()
input_box.send_keys(token)
input_box.send_keys(Keys.RETURN)
except (NoSuchElementException, TimeoutException):
# Token element not found, refresh the page
print('Refresh')
driver.refresh()
check_and_refresh()
check_and_refresh()r/SeleniumPython • u/Letuku • Jul 16 '23
I'm reaching out to this community for some advice regarding the use of Selenium for managing a Twitter account.
Due to changes in Twitter's API policies, I am considering cheaper alternative methods to help a client unfollow a large number (over 12K) of users for the Twitter account of a business she acquired. One option that came to mind was using Selenium to automate the process.
My plan is to program it to unfollow up to 100 users per day, spread throughout the day, to avoid any aggressive or suspicious activity.
However, I'm unsure about the implications this might have on the account. I know that Twitter has rules about automation and I want to make sure I don't end up getting my client's account suspended.
Has anyone here used Selenium or similar tools for such purposes? If so, could you share your experiences? Also, I would greatly appreciate any tips on how to do this while staying within Twitter's rules and guidelines.
r/SeleniumPython • u/TheGandyMan • Aug 05 '23
I got IP banned for scraping a site. I know that many things could have caused this, but I'm wondering if I'm making too many requests. I have quite a few find_elements() scraping a single site. Are each of them a request to that site, resulting in potentially too many requests? I want to make one request to the site and then sort through the html to find all the bits I need without requesting the site a bunch. I'm not sure if that's what I'm already doing or not.
Hope that made sense.
r/SeleniumPython • u/Illustrious-Worth218 • Apr 28 '23
Trying to iterate over a grid (collection) of elements, I have to continue scrolling down the page but at a point (180- elements) I get an error:
```selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document```
Here's basically what I'm trying to do:
```
for element in elements:
while True:
cls.wait_element_to_visible(driver, 50, 'group.element')
element = driver.find_element(By.CSS_SELECTOR, 'group.element')
element.DoSomething()```
Could you point me in the right direction.
r/SeleniumPython • u/DaveDarell • Jun 30 '23
Hi,
I've written a code which is checking a website for me if there are new grades. In the past there was the problem, that sometimes the code has crashed. I think it is in combination with the chrome webdriver.
So I was thinking whether I should look for a function which is restarting the code e.g. every 6 hours? Would you recommend that? Or would you say the problem is somewhere else and Selenium and the Webdriver is built for running a long time stable?