Recently, I've been experimenting with using Python 3.6 and Selenium to automate a simple task - logging into a chat website and sending messages automatically. is the webpage where I want to send the messages. Despite my limited experience with Python, ...
I'm currently facing a challenge with converting the output format of certain keys in a JSON file from scientific notation to float values within the JSON dictionary. For instance, I want to change this: {'message': '', 'result': [{'Ask': 8.982e-05 ...
My CSV file contains millions of rows, and I need to start iterating from the 10,000,000th row. Currently, I am using the following code: with open(csv_file, encoding='UTF-8') as f: r = csv.reader(f) for row_number, row in enumerate(r ...
I have two files, app.py and views.py app.py from flask import Flask from flask_pymongo import PyMongo app = Flask(__name__) app.config["MONGO_URI"] = "mongodb://local:27017/local" mongo = PyMongo(app) from views import profileview profileview.register(ap ...
After creating an executable using pyinstaller, I faced an issue where the executable file would open a blank cmd window that closes after a few seconds. Interestingly, when I run the python file directly using python file.py in the command prompt, it work ...
As a newcomer to Python/Selenium, I am attempting to construct a statement that will execute an alternative action when the specified element cannot be located. Below is the code snippet in question. pickActiveDay = driver.find_element_by_xpath('//di ...
I'm facing an issue while trying to access a pre-existing selenium browser session from a separate python process. The reuse logic works perfectly within the same python script, but fails when separated into a different script, displaying the following err ...
Attempting to extract data from a paginated table using Selenium. The website being scraped does not have pagination in the URL. table = '//*[@id="result-tables"]/div[2]/div[2]/div/table/tbody' home = driver.find_elements(By.XPATH, '//tbody/tr/t ...
I initially had success using a tkform library in Python2, which worked flawlessly. However, upon transitioning to Python3, I encountered issues running it, specifically with the line: from idlelib.WidgetRedirector import WidgetRedirector It appears that ...
On a website, I am working with the HTML code below to extract the number of jobs from a table: <span class="k-pager-info k-label">1 - 10 of 16 items</span> Although I can locate the element successfully through different methods, wh ...
My goal is to read elements from a file, add each line to print its output. However, I have been unsuccessful in my attempts so far. For example, if I try to access a certain number: with open('test.txt', 'r') as f: for line in f: ...
Attempting to gather search results from Walmart has been a challenge for me. For instance, let's navigate to the website "" Then, try to extract only the text from the element identified by the class name search-product-result, using python. ...
I have developed a script to extract the names and addresses of various results (56 in this scenario) from a website. The addresses are only visible once a click is triggered on each result. However, when executing the script, I am able to obtain two resul ...
Can named pipes in Python be utilized for a specific use case? I am trying to achieve the following using named pipes. fn = path/to/my/file.ext os.mkfifo(fn) subprocess.check_output(args=(bar -o fn).split()) foo(fn) I want to avoid writing the output of s ...
Earlier, I posed a question that was related but more general (check out this response). Now, my question is very specific. The only code that matters to me is: result = {} for line in open('input.txt'): key, value = parse(line) result[key] = value ...
In my file test_final.txt, I have a collection of simple words and sentences that I want to shuffle using the shuffle method. However, when I implement the code, it empties out my test_final.txt. Additionally, I am struggling to understand why the Shuffle ...
Presently, my Python 2.7 code is set up to handle <str> objects received over a socket connection. Throughout the codebase, we heavily rely on <str> objects for various operations and comparisons. Transitioning to Python 3 has revealed that soc ...
Currently, I am working on automating UI testing using the Page Object Model (POM) in Python with Selenium. One question that I have is how to handle duplicate test cases efficiently. For instance, let's consider two web pages: the Login page and the ...
I have encountered an issue while using an actions chain to input text, where duplicate characters appear. I suspect this might be due to the lack of delay. How can I fix this problem? Here is an example code snippet: big_text = "Lorem ipsum dolor sit ...
Currently, I am engaged in processing signals on an extensive dataset of images. This involves converting the images into large feature vectors that follow a specific structure (number_of_transforms, width, height, depth). Due to the size of these feature ...
Struggling to correctly format the path using the base64 module, my desired output should resemble: C:UsersUser_NameDocumentsphotosphoto.png In a previous attempt, I checked the variable image_open and saw the slashes. However, after decoding and ...
When working with multiple datafiles, I use the following code to load them: df = pd.concat((pd.read_csv(f[:-4]+'.txt', delimiter='\s+', header=8) for f in files)) The resulting DataFrame looks like this: ...
I need to filter out specific data from a JSON file using a predefined list of keys and save it as a new JSON file. For example: { "211": { "year": "2020", "field": "chemistry" }, " ...
Can someone help with automating the completion of the application form below using Python? enter image description here I am struggling to fill out the phone number field in the form. The last name, first name, and email are randomly populated from the ...
While trying to automate website navigation using Selenium, encountering an issue stating: Access Denied. The server denies permission to access "http://tokopedia.com/". from selenium import webdriver from selenium.common.exceptions import NoSuch ...
Seeking a solution to this particular issue: There are two functions that need to be implemented: def function1(): while True: print("x") def function2(): while True: print("y") The goal is to execute these functions alternately ...
To provide more clarity: I am developing an intersection control system for cars where each car must register its address in a shared list (intersectionList) if it intends to cross the intersection. If cars are on road piece 20 or 23, they add their addre ...
When I execute this code, I encounter an error: from pytrends.request import TrendReq google_username = '' google_password = '' pytrend = TrendReq(google_username, google_password, custom_useragent='My Pytrends Script') pytrend.build_payload(kw_list=['app ...
The Python 3 filter function is useful for returning elements from an Iterable that meet specific criteria set by a filter function. What if instead of getting the elements, I want to obtain the index of those elements? It's similar to using the index meth ...
Here is the code snippet I am using: #!/usr/bin/python3 from selenium import webdriver driver = webdriver.Firefox(executable_path=r'/usr/local/bin/geckodriver') driver.get('http://www.python.org') The error that I am encountering is ...
I need to create a button that loops through all records and performs a method that generates a list of ranges between two fields. Then, it should remove another record from the list and place the value in the result field. I have implemented the code bel ...
While I am able to retrieve pageviews info for other pages, I'm encountering an error when trying to fetch data from a particular page. The error message reads: File "<unknown>", line 1 article =='L'amica_geniale_ (serie_di_romanzi ...
Why is the output of this seemingly simple code different than expected? I've searched for similar questions but haven't found one that addresses my issue. Here is the code in question: def test(f): f.append(0) f.append(0) return f i = [0] * ...
When I attempt to fetch a request from urllib3, my code successfully works. However, I have encountered issues with certain websites like that utilize different TLS versions and are unable to be fetched. I made an attempt to alter the useragent, but it di ...
I am encountering an issue while attempting to play a video file and the error message reads as follows: $ /usr/bin/python3.4 /home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py Traceback (most recent call last): ...
I am planning to share my Python program with others and I would like to convert it into a .exe file using py2exe. However, I encountered an issue while using Selenium. chrome_path = r"C:UsersViktorDesktopchromedriver.exe" If users do not have the sa ...
Just starting out as a beginner in Python. I am currently learning the language through a book called "Breaking Ciphers with Python". As part of a basic encryption program, I have written the following code snippet (this is just the beginning): import pyp ...
Website myList = ['Artik'] How do I verify if the content of myList is visible on the mentioned website? <span class="ipo-TeamStack_TeamWrapper">Artik<span> This specific webelement showcases 'Artik' in the given websi ...
I'm currently facing an issue while attempting to delete an event from my Google Calendar. An error keeps popping up indicating that the webdriver is unable to locate the element. Here's an image of the problematic element. Exception has occurred ...
I found myself in a unique situation where my AWS farm was running smoothly with capabilities options for Chrome and Firefox using my own Selenium framework, but encountered failures when setting it to INTERNETEXPLORER. self = <selenium.webdriver.remote ...
I have developed a Python script using Selenium to extract all the reviews from a specific page on Google Maps. This page contains numerous reviews that are only visible when scrolling down. My script successfully retrieves all of them. However, I am curr ...
I've been experimenting with web automation using Selenium. Everything was running smoothly until I updated my packages - now the send_keys() method isn't functioning on Linux, but it's working fine on Windows with the same versions. I&apo ...
I have reviewed similar questions but haven't found a solution that works for me. My inquiry is regarding the following code snippet: function pyInput(){ const buffers = []; proc.stdout.on('data', (chunk) => buffers.push(chunk)); proc.stdo ...
While the Python code within the 'outer' function runs smoothly on its own, placing it inside a class seems to cause issues that are difficult for me to comprehend. (I am aware that I could simply pass data as a variable inside the function or d ...
As a newcomer to Python, I am eager to retrieve data from my private account on the cryptocurrency market bitbay.net. You can find the API description here: Below is my Python 3.5 code snippet: import requests import json import hashlib import time has ...
I've encountered an issue with my Python tool that reads through a tar.xz file and handles each individual file within it. The input file is 15MB compressed, expanding to 740MB when uncompressed. Unfortunately, on a particular server with limited memory r ...
Encountered an issue while attempting to install dlib using the command "pip install dlib" on Windows. The error message states:</br> ------------------------------------------------------------------------------</br> You must ...
Having recently delved into testing, pytest fixtures have caught my attention. However, I'm not entirely clear on when to use them and how they can be beneficial. An illustration of this dilemma can be found in the following code snippet: import pytest @ ...
I am trying to loop through a list of strings and replace any occurrence of a specific character, like '1', with a word. However, I'm puzzled as to why my current code is not working. for x in list_of_strings: x.replace('1', 'Ace') Just a heads up, t ...
From what I gather, Python's itertools.chain function is meant to concatenate multiple iterators. In the scenario where the first iterator contains ['a/a.jpg', 'a/b.jpg'] and the second iterator is empty, the expected result shoul ...
One thing I'm trying to figure out is how to connect a two-input text field and an output text field on a PHP page (index.php) with a Python multiplication function (add.py). Basically, I want the input from the PHP page to be used in the Python funct ...
Having the following line in python: driver.find_elements(by=By.TAG_NAME, value='a') Is there a way to modify this line to include additional values like b, c, d, etc...? I attempted this approach but it was unsuccessful: driver.find_elements(by=By.TAG_N ...
I'm having issues running my Python script as it keeps displaying the same error message: Failed to establish a new connection: [Errno 10061] No connection could be made because the target machine actively refused it. Note that I have disabled my f ...
Below is the code I have written to achieve a specific task: my_list = WebDriverWait(driver, 20).until(EC.visibility_of_all_elements_located((By.XPATH, "//table[@border='1']//a"))) for option in my_list: option.click() WebDriverWait(drive ...
I am working with a dictionary obtained from a cURL call in Python 3.8 and my goal is to extract information from just two specific keys to create a list that can be written into a csv file. The dictionary contains only one key-value pair, where the value ...
--------Responding to a Post Identified as a Duplicate Question As I am still in the process of learning the basics of programming, I was uncertain about the relevance of the information provided in the other post, particularly since it pertained to the i ...
Recently, I developed a function to compute the log returns of a given dataset. The function accepts the file name in CSV format as an argument and is expected to output a dataframe containing the log returns from the dataset. The CSV file has already been ...
I have created a Python database using SQLite3 and I am encountering an error when trying to add data. The error message states, You did not supply a value for binding 1. I have previously made the same type of database with different values and did not fa ...
I'm seeking a method to make filtering capabilities accessible to fellow developers and potentially clients within my workplace. Challenge I aim to introduce a basic query language for my data (stored as python dicts) that can be used by other developers ...
import tkinter import tkinter.messagebox import sys top=tkinter.Tk() from tkinter import* def clear(): e1.delete(0,END) return def seven(): v.set(v.get()+str("7")) v.get() def eight(): v.set(v.get()+str("8")) v.get() def ni ...
import unittest from selenium import webdriver from datetime import datetime class Index(unittest.TestCase): @classmethod def setUpClass(cls): chrome_options = webdriver.ChromeOptions() prefs = {"profile.default_content_setting_values.notificat ...
After crafting a Python script to format a text file for SQL importation, I discovered that it perfectly runs with python 3.5. However, when attempting to execute the script with python 2.7 (as required), an error is thrown which reads: TypeError: 'newline ...
Currently, I am developing Python code that involves frequent inversion of large square matrices containing 100-200 rows/columns. The precision limits of the machine are being reached, prompting me to experiment with using mpmath for arbitrary precision m ...
Suppose I have a table like this: greeting = ["hello","world"] Then, I convert it into a string: greetingstring = str(greeting) Now the challenge is to change it back into a table. What would be the approach for accomplishing this tas ...
I've searched all over the internet but am still struggling to fix the error I encountered while attempting to run a test script on my testing environment. "The certificate is not trusted because the issuer certificate is unknown. The server migh ...
Currently, I am executing a Selenium web-scraping loop on Chrome using MacOS arm64. The goal is to iterate through a list of keywords as inputs in an input box, search for each one, and retrieve the text of an attribute from the output. A few months ago, I ...
I am facing an issue while trying to fetch media posts from last month on an Instagram Business profile that I manage. Despite using 'since' and 'until' parameters, the API is returning posts outside of the specified time range. The AP ...
Weekly, I am trying to automate downloading files at a specific time and day chosen by the user, similar to what is displayed in this image. My current challenge involves integrating an inner loop concerning root.mainloop(). I have experimented with both . ...
I'm a newbie to TensorFlow and Python, and I've developed a model that categorizes text based on its toxicity level (obscene, toxic, threat, etc). The model seems to be working fine as it produces the summary. However, I'm having trouble pas ...
Recently delving into the world of selenium, I encountered an issue while trying to scrape a website with 10 results per page displayed in lists (li tags). Each list contains the same attributes and when certain conditions are met, I navigate to another re ...
My goal is to create collision detection between turtle objects that are represented as circles. To achieve this, I need to determine the radius of these circles. import turtle as t screen=t.Screen() screen.setup(1.0,1.0) screen.bgcolor("#000") ...
When trying to click on a specific element based on the text displayed on this page using Python 3 and Chrome driver, I encountered an issue. For instance, when searching for "BEBES", I used the following code: WebDriverWait(browser, 10).until(EC.element_ ...
I have created a DRF API View in my Django project to manage Withdraw records. Below is the implementation: class WithdrawListCreateAPIView(PartnerAware, WithdrawQuerySetViewMixin, generics.ListCreateAPIView): permission_classes = (TokenMatchesOASRequi ...
On my webpage, a table is populated dynamically through an API call. Each row in the finalized table is structured as follows: <tr class="ant-table-row ant-table-row-level-0" data-row-key="0"> <td class="">Value1</td> <td class="" ...
Testing my code on Visual Studio 2017 with the file named test: from flask import Flask, request #import main Flask class and request object from test import app app = Flask(__name__) #create the Flask app @app.route('/query-example') def ...