Skip to content
Advertisement

Tag: selenium

How do I delete/exclude selected children nodes from the parent node in Selenium/Python?

Say, I’d like to get the article without to_del (could contain 0 or several elements). Seems driver.execute_script is the solution. But how to code it? Answer https://www.w3schools.com/jsref/met_element_remove.asp The remove() method removes the specified element from the DOM. we are using while and refinding the elements to avoid stale element error as the DOM changes whe nyou delete a node

What is the error OpenQA.Selenium.WebDriverException : javascript error: document.getElementByName is not a function

I got a error in executing the below line of code I got the error At line 3 document.getElementByName is not a function (Session info: chrome=87.0.4280.141) what is the reason for it? Answer The JavaScript method is document.getElementsByName(…) (plural – Elements not Element). This method returns a collection of elements, not a single element. Be sure to access the [0]

Is there any equivalent to selenium FindElements By.XPath in chrome extension java script?

I have some experience in Selenium, using some code as below to locate elements using XPath; I recently started to develop an Chrome extension, and I could not find any similar way to locate elements using easier way similar to XPath. I’m having many complex queries developed in selenium, using the XPath methods. I just want to do the same

How tho check this checkbox (capybara/ruby)

How to check this checkbox?enter image description here I tried: No success! =( I got this error: … Answer Don’t use direct driver calls or execute_script to try and click on things – if you’re having to do that you’re doing something wrong. Generally for things like this I’d also recommend using CSS rather than XPath but XPath may make

Unexpected token ‘<'

I am using this to add html between a div tag but it displays Unexpected token ‘<‘ The x[“solution”] is a json file which contains html like <strong> bold </strong> etc. Answer You forgot to quote the right part of the equality. This code is generating: Also, you can use a single formatted string which would look like: and would

Powershell with Selenium: Error: element not interactable

I need to update a textarea with a value. The code below throws an error “element not interactable”. This is because the textarea has “display:none”. If I remove the word NONE manually and then run the script again, it works great and is able to set the value of the textarea. So the only option available is to use Javascript

Scrape data inside a JavaScript function by using python selenium

Please let me know if there is any option available to scrape data inside a JavaScript function below using Selenium page https://www.bayut.com/index/sale-prices-apartments-abu-dhabi.html input code … Output Date Value 2010-01-31 1443 2010-02-28 1407 Tried but not working My output file should have date and value columns, please let me know if there is option available Answer use driver.execute_script:

Advertisement