I am struggling to get this Taurus script to run correctly on Blazemeter.
The scriptEval syntax appears to be incorrect as it keeps giving me errors, in particular on the HOMEPAGE label step, where we want to modify some date inputs. How can I modify it so it is correct?
I have tried executeScript, scriptEval and using the JS in blocks and in separate lines.
nose:
ignore-unknown-actions: true
execution:
- executor: selenium
scenario: BOOKING-Selenium
iterations: 1
concurrency: 5
capabilities:
browserName: chrome
scenarios:
BOOKING-Selenium:
generate-flow-markers: true
headless: false
timeout: 60s
think-time: 0s
requests:
- label: AUTH
actions:
- type: go
param: 'https://development.co.uk'
timeout: 10
- scriptEval("document.getElementById("onetrust-accept-btn-handler").click();")
- scriptEval("document.querySelector("li.item > a").click();")
- label: HOMEPAGE
actions:
- type: go
param: 'https://development.co.uk/home/'
timeout: 10
- scriptEval:("var monthDropdown = document.getElementById('month');")
- scriptEval:("var monthOptions = Array.from(monthDropdown.options).filter(function(option) {return option.text.includes('2024')});")
- scriptEval:("var randomIndex = Math.floor(Math.random() * monthOptions.length);")
- scriptEval:("var randomMonth = monthOptions[randomIndex];")
- scriptEval:("monthDropdown.value = randomMonth.value;")
- scriptEval:("var randomDay = Math.floor(Math.random() * 28) + 1;")
- scriptEval:("var dayDropdown = document.getElementById('day');")
- scriptEval:("dayDropdown.value = randomDay;")
- scriptEval:("var minNights = 5;")
- scriptEval:("var maxNights = 14;")
- scriptEval:("var randomNights = Math.floor(Math.random() * (maxNights - minNights + 1)) + minNights;")
- scriptEval:("var nightsDropdown = document.getElementById('nights');")
- scriptEval:("nightsDropdown.value = randomNights;")")```