Questions tagged [execute-script]

60 questions
330
votes
16 answers

Wait until page is loaded with Selenium WebDriver for Python

I want to scrape all the data of a page implemented by a infinite scroll. The following python code works. for i in range(100): driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") time.sleep(5) This means every time I…
apogne
  • 3,435
  • 3
  • 13
  • 7
7
votes
2 answers

Python and Selenium To “execute_script” to solve “ElementNotVisibleException”

I am using Selenium to save a webpage. The content of webpage will change once certain checkbox(s) are clicked. What I want is to click a checkbox then save the page content. (The checkboxes are controlled by JavaScript.) Firstly I used:…
Mark K
  • 8,767
  • 14
  • 58
  • 118
4
votes
1 answer

Chrome extension: chrome.scripting.executeScript not working

for some reason my executeScript function is not working. This is my code: async function scrape_get_url(){ console.log("Getting url: " + from_url); var tab_id; chrome.tabs.create({ "url": from_url}, function(newTab){ tab_id =…
JorensM
  • 330
  • 4
  • 15
2
votes
2 answers

Modify HTML with Selenium

I want to use Selenium (running with Python 3) to modify a specific HTML element in the browser so that it has "mark" tags around it (thereby highlighting the text I am interested in). Is there a way to do this?
Alex Heebs
  • 740
  • 1
  • 8
  • 16
1
vote
2 answers

Webview2 ExecuteScriptAsync to click an Input button

Please see below this html code for understand: I want to…
micheline
  • 61
  • 1
  • 7
1
vote
2 answers

Protractor browser.executeScript throws Failed: javascript error: missing ) after argument list

When running the protractor script below let resultantArr = []; resultantArr = await browser.executeScript("var elements = document.querySelectorAll('ul[class=\'wbs-droplist-container\'][id*=\'droplist\']…
Poovin
  • 164
  • 3
  • 15
1
vote
1 answer

selenium.common.exceptions.InvalidSelectorException: Message: Given xpath expression is invalid using xpath within scrollIntoView through Selenium

I use Python to scrape a website with a filter pane that needs to be scrolled. I found a code that helps to scroll through the list of elements, that actually find a list and move through a loop. recentList =…
1
vote
1 answer

NIFI Executescript UTC Error for unsupported operand type "+" in java.sql.Timestamp and timedelta

I am trying to split a flowfile into multiple flow files on the basis of adding a month to a date which i am getting in the coming flowfile. eg. {"to":"2019-12-31T00:00:00Z","from":"2019-03-19T15:36:48Z"} be the dates i am getting in a flowfile .…
1
vote
1 answer

Dynamic website find element by class name and execute onclick method associated with the class in Python with Selenium and Chrome

I'm working on Python, Selenium and Chrome driver. I have a dynamic website and every time site loads the IDs get changed, Hence I can't use Xpath. But I can use the class name. I can get to the class as below; Following is the code of the site.
1
vote
2 answers

Python Selenium a hidden frame that appears sometimes with java script assert

I have a notification that appears in a couple of times a week on this website I scrape. And I can't get around it. I can run the code. el = driver.find_element_by_xpath("//input[@id='btnRead']") driver.execute_script("arguments[0].click();",…
dommynick
  • 13
  • 3
1
vote
3 answers

UnhandledPromiseRejectionWarning: Error: Script failed to execute- Electron execute script

i try to excuteJavaScript in electron function createTestGmail(username, password){ username = '12344444444444444444444444asdasd44444444' testGmail = new BrowserWindow({ width: 500, height:300, …
vy.pham
  • 571
  • 6
  • 20
1
vote
0 answers

loading pdf.js for use in content script of chrome extension

I am new to javascript and chrome extensions so please go easy on me problem: I have a chrome extension that currently deals with html pages- but I would also like for it to be able to handle online embedded PDFs when viewed in my chrome…
1
vote
1 answer

How can I use selenium to record mathjax loading time

I am trying to use selenium get asynchronous elements(MathJax equation) loading time. I try to write a python-selenium script to record the loading time of my website, but my website contains a lot of equation which converted by Mathjax…
OliverL
  • 13
  • 2
0
votes
0 answers

Check if a URL matches one of the patterns in a chrome extension manifest v3 content script "matches" field

I have a chrome extension in which I'm using the chrome.runtime.onInstalled event to reinject my scripts when an update happens. chrome.runtime.onInstalled.addListener((details) => { installContentScript(); }); Inside of installContentScript() I…
0
votes
1 answer

Javascript code failing for success as well

I am writing code in Apache nifi's execute script processor in javascript. NOTE: NO in-built function or method of javascript like isEmpty(), Object.Entries, or etc doesn't works in nifi's processor. So I have to write very basic code My code is…
dracile
  • 59
  • 6
1
2 3 4