Development

Here’s a trap that talented engineers fall into all the time. It creates frustration, burnout, and the genre of tweets…

I would like to ask whether it is possible on JMeter to recreate the response on the web browser. Just some quick tip will do. Here is the response that it needs.

My configuration is that I have a CSV file that contains all the ID i need. Then it is inside an Loop controller where I loop it for many times as I needed for selection.

Hope someone can help me. Thanks

I am running this code:

from selenium import webdriver
from `selenium.webdriver.firefox.options` import Options

Setup:

options = Options()
options.add_argument(“–headless”)

def get_results(search_term):

url = “https://www.wikipaedia.org”
browser = webdriver.Firefox(firefox_options=options, executable_path=r”/usr/local/bin/geckodriver”)
browser.get(url)
search_box = browser.find_element_by_id(“query”)
search_box.send_keys(search_term)
search_box.submit()

try:

links = browser.find_elements_by_xpath(“//ol[@class=’web_regular_results’]//h3//a”)

except:

links = browser.find_elements_by_xpath(“//h3//a”)

results = []

for link in links:

href = link.get_attribute(“href”)
print(href)
results.append(href)

browser.close()

return results

I’m getting error messages:

Traceback (most recent call last):
File “search_items.py”, line 37, in <module>
get_results(“dog”)
File “search_items.py”, line 13, in get_results
search_box = browser.find_element_by_id(“query”)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 351, in find_element_by_id
return self.find_element(by=By.ID, value=id_)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 955, in find_element
‘value’: value})[‘value’]
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/webdriver.py”, line 312, in execute
self.error_handler.check_response(response)
File “/usr/local/lib/python2.7/dist-packages/selenium/webdriver/remote/errorhandler.py”, line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: [id=”query”]

I have tried to solve but it is beyond me.
Any help would be greatly appreciated.

The DistroWatch news feed is brought to you by TUXEDO COMPUTERS. The OpenMandriva project has announced the availability of a new testing snapshot. The new release candidate for OpenMandriva 24.07 “ROME” introduces the KDE Plasma 6 desktop environment. “One of the most notable changes is the switch to Plasma 6 as the default desktop environment. This major release of….