How to extract text from div class using Selenium with Python

I am trying to create a bot to pay some bills automatically. The issue is I can’t extract the amount(text) under div class. The error is element not found. Used driver.find_element_by_xpath and WebDriverWait. Can you please indicate how to get the highlighted text-see the attached link? Thanks in advance.Page_inspect Answer I believe there was some issue with your xpath. Try below it should work:

Adding JavaScript event listener with Selenium triggers it automatically

As there is (according to my research) no way to catch user input with selenium, I am trying to use a JavaScript event listener. But when I add the event listener by executing the JavaScript code, the function is automatically triggered without me (as the user) doing anything. Furthermore, there is no way to trigger the function again. Does anyone know what the problem might be and how I could solve it? FYI: My code is in Python 3.8 Thank you in advance, Raphael The console displays “success” as soon as the script is executed, afterwards the event is never

inputs being filled in too fast in selenium | python 3.8

so I am trying to log into this website called ttrockstars, and I have written a function to login to the website. However the code seems to be running too fast and ignoring time.sleep(5) that i have added to the code: When I run this, it simply enters the school name and then deletes it and enters the username and then brings up an error saying the password box does not exist. This would not be a problem if it actually submitted the school and waited 5 seconds. Why is this happening and is there a workaround? Answer These are

Unable to enter text using send keys in selenium webdriver python

I am trying to enter text in “keywords” section using send keys command. Please find my below code. Answer There are two elements with same id I used driver.find_elements_by_id(“keywords”) method to get all of them as a list and i accessed the required using index number

Splitting list of strings based on a character in each string ( Python )

So i have a list of strings that looks like this : This is how the list is generated and made readable (“video” is a list of selenium webelements ) : What i want to do is SPLIT this list into two other lists based on ONE specific character in each element like so : My end goal is to be able to have only the numbers in the elements as a float and multiply each element by their appropriate amount ( K = *1000 and M = *1000000 ) like : I’m new to python (coding in general tbh)

How to click button in pop up window using python-selenium

I’m working to automate web page where i’m unable to close the pop up. I have tried to refresh/switch to pop up window, nothing worked. Code: If you want directly go to web page, https://buy.libertymutual.com/auto?city=Somersworth&jurisdiction=NH&lob=Auto&policyType=Auto&zipCode=03878 Answer Replace last 3 lines of your code by below lines.Used action chain to click.

Submitting reCAPTCHA v2 with selenium and python – no form submit button

So I recently signed up with anti-captcha and have been testing with the https://github.com/ad-m/python-anticaptcha/blob/master/examples/recaptcha_selenium.py script. I cannot get past a reCAPTCHA that has no submit button (hidden or visible) nor a clear way to submit for verification. I’ve used the anti-captcha firefox plugin, so I know it can be passed. But I am stuck at the point of doing this manually myself. I thought this was going to be a helpful answer, but it doesn’t go into depth. I am able to get the job.get_solution_response() token and enter it into the required textfield, but I cannot submit the “form.” Does

Using Tkinter, Threading and After method

im working on a selenium project using tkinter in python. I want to execute many selenium task at one time(could be up to 100), so I used threading to accomplish this goal, but I came to a problem, due to the fact that I need all individual selenium task to wait a couple seconds between instructions, I used the ‘.after’ method but for some reason my program is still freezing up, I’ve done a lot of research but I cant seem to find the answer yet. Isn’t there a way to use tkinter, threading and some sort of sleeping in

pycharm python selenium scraper apparently not printing correct value

I new to python, selenium, pycharm and such. I’m trying to print the value of a on a website ( at the moment of writing this the value is 6320 ).The code is not giving errors but it’s printing nothing. As you can see in the screenshot, when i’m debugging and hovering over the variable, it’s displaying 6320, which is the value i’m looking for. What am I doing wrong? Thanks a lot for your help! Answer You need wait until .visibility_of_element_located and use this xpath: //td[contains(., “Total*”)]//span[last()], although your xpath also works, but it is an absolute xpath that

How do I run through a list of links one by one and then scrape data using selenium(driver.get)?

I’m trying to loop through 2 sets of links. Starting with https://cuetracker.net/seasons > click through each season link (Last 5 seasons) and then click through each tournament link within each season link and scrape the match data from each tournament. Using the below code I have managed to get a list of season links I desire but then when I try and grab the tournament links and put them into a list it is only getting the last season tournament links as opposed to each season’s. I’d guess it’s something to do with driver.get just completing before the next lines