mcdcorp / opentest

Open source test automation tool for web applications, mobile apps and APIs
https://getopentest.org
MIT License
446 stars 107 forks source link

Help with a javascript website #614

Closed vmsoriano closed 1 year ago

vmsoriano commented 1 year ago

OpenTest version number: 1.4.1

If I try to set up a web test against a website written in Angular, the test works perfectly, however if I do the same against a website that contains a javascript application, I only get a blank screen and the page doesn't load.

Selenium options:

Selenium options

selenium:

seleniumServerUrl: http://127.0.0.1:9515

desiredCapabilities:
    browserName: chrome
    chromeOptions:
chromeDriverExePath: /usr/bin/chromedriver
chromeDriverExeArgs: [headless, start-maximized, disable-extensions, disable-dev-shm-usage, no-sandbox]
resolution: 1920x1080
edgeDriverExePath:
firefoxDriverExePath: C:/Selenium/geckodriver.exe
# firefoxDriverExeArgs: []
ieDriverExePath:
# ieDriverExeArgs: []
operaDriverExePath: C:/Selenium/operadriver.exe
safariDriverExePath: /usr/bin/safaridriver
systemProperties:
    # property1: value1
Keonik1 commented 1 year ago

@vmsoriano maybe it will help? https://github.com/mcdcorp/opentest/issues/604#issuecomment-1504874522

vmsoriano commented 1 year ago

don't work for me, i think its a problem with bot detection, homepage return blank but in browser the page show correctly.

I need to configure selenium stealth, but i dont know how introduce this parameters in actor.yaml

options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('useAutomationExtension', False)

Keonik1 commented 1 year ago

@adrianth can you correct me @vmsoriano if i correct understood you are need add chromeExperimentalOptions to your actor: (syntax maybe incorrect, i doesnt know how correct convert yaml to java Map)

chromeDriverExePath: /usr/bin/chromedriver
chromeDriverExeArgs: [headless, start-maximized, disable-extensions, disable-dev-shm-usage, no-sandbox]
chromeExperimentalOptions: {"excludeSwitches": "enable-automation",  "useAutomationExtension": False}

or like this maybe:

chromeDriverExePath: /usr/bin/chromedriver
chromeDriverExeArgs: [headless, start-maximized, disable-extensions, disable-dev-shm-usage, no-sandbox]
chromeExperimentalOptions:
  excludeSwitches: enable-automation
  useAutomationExtension: False

link to source code: https://github.com/mcdcorp/opentest/blob/0aa4a9d288d4ecef4183f4fafe59fb95da7ae967/actor/selenium/src/main/java/org/getopentest/selenium/core/SeleniumHelper.java#L85-L89 source code screenshot: image

vmsoriano commented 1 year ago

I try it, but when i type a list on actor.yaml

Caused by: org.openqa.selenium.InvalidArgumentException: invalid argument: entry 0 of 'firstMatch' is invalid
from invalid argument: cannot parse capability: goog:chromeOptions
from invalid argument: cannot parse excludeSwitches
from invalid argument: must be a list
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'ecrlpa06', ip: '10.31.134.24', os.name: 'Linux', os.arch: 'amd64', os.version: '4.18.0-425.19.2.el8_7.x86_64', java.version: '11.0.19'

And my config file

# Selenium options
selenium:
    # seleniumServerUrl: http://127.0.0.1:9515
    desiredCapabilities:
        browserName: chrome
        chromeOptions:
    chromeDriverExePath: /usr/bin/chromedriver
    chromeDriverExeArgs: [headless, start-maximized, enable-javascript, disable-extensions, disable-dev-shm-usage, no-sandbox]
    chromeExperimentalOptions:
       excludeSwitches: enable-automation
       useAutomationExtension: False
    resolution: 1920x1080
    edgeDriverExePath:
vmsoriano commented 1 year ago

I think i solve the problem but i only update chromedriver to version 113

Thanks all