Webdriverio: An element could not be located on the page using the given search parameters.

Created on 14 Apr 2017  ·  3Comments  ·  Source: webdriverio/webdriverio

The problem

I am using webdriverio mocha
and I can not click on a element.
I got always the same error

An element could not be located on the page using the given search parameters.

Environment

Details

Link to Selenium/WebdriverIO logs

Create a gist which is a paste of your _full_ Selenium/WebdriverIO logs, and link them here. Do _not_ paste your full Appium logs here, as it will make this issue very long and hard to read! If you are reporting a bug, _always_ include Selenium/WebdriverIO logs!

Code To Reproduce Issue [ Good To Have ]

this is my test

describe ('FAFSA', function () {
    beforeEach(function() {
        browser.url('/');
    })
        it ('should look good', function () {
            browser.click("//*[@id='start']");
            browser.click("//*[@id='inner-content']/section/div/div/div[1]/div/a");



        });
    });

and this is the element on the page

<div id="inner-content" ng-view="" class="right-panel ng-scope"><section class="page-block select-type ng-scope" ng-show="ready"><div class="select-type__wrapper"><div class="row"><div class="col-sm-6"><!-- ngIf: device === 'phone' --><!-- ngIf: device !== 'phone' --><div ng-if="device !== 'phone'" class="block ng-scope"><a ng-activate="" ng-click="startApplication('?json=true')" class="btn btn-answer first ng-scope ng-click-active"></div><!-- end ngIf: device !== 'phone' --></div><div class="col-sm-6"><!-- ngIf: device === 'phone' --><!-- ngIf: device !== 'phone' --><div ng-if="device !== 'phone'" class="block second ng-scope"><a ng-activate="" ng-click="startApplication('?parent-user=true&amp;json=true')" class="btn btn-answer ng-scope ng-click-active"></div><!-- end ngIf: device !== 'phone' --></div></div></div></section></div>

All 3 comments

Your selector doesn't find an element. Please use a different selector or try to debug the page to make sure you are on the expected page.

Also join our Gitter for these kind of questions. This is not necessary an issue.

I am also having same issue

module.exports = function() {

this.Given(/^I have visited bct-test.ucdavis.edu$/, function () {
browser.url('https://bct-test.ucdavis.edu/bct_nation/home.seam');
});
this.When(/^I click Browse Trials$/, function () {
browser.click('#HomeBrowseButton');
});
this.Then(/^I see All Trials$/, function () {
browser.screenshot('BrowseTrialsMetastaticLink.png');
});

this.When(/^I search All Trials for "([^"])" or "([^"])"$/, function (SearchTerm1, SearchTerm2) {
// Write code here that turns the phrase above into concrete actions
browser.setValue('input[Search_Query_Term1="R"]', SearchTerm1);
browser.setValue('input[Search_Query_Term2="O"]', SearchTerm2);
browser.click(['searchGo']);
});

this.Then(/^I see All Trials for "Reproductive" and "Online"$/, function () {
var my_expected_text='Trials contain';
var my_displayed_text = document.getElementsByClassName('ContentHeaderText');
expect(my_displayed_text).toBe(my_expected_text);
});
}

Error Message:
[chimp] Running...
Feature: Search All Trials

As a breast canceer patient
I want to search the All Trials on the web
So I can find information

Scenario: Search for Reproductive or Online
✔ Given I have visited bct-test.ucdavis.edu
✖ When I search All Trials for "Reproductive" or "Online"

  • Then I see All Trials for "Reproductive" and "Online"

Failures:

1) Scenario: Search for Reproductive or Online - features/searchalltrials.feature:7
Step: When I search All Trials for "Reproductive" or "Online" - features/searchalltrials.feature:9
Step Definition: features/support/searchalltrials.js:13
Message:
Error: An element could not be located on the page using the given search parameters ("input[Search_Query_Term1="R"]").
at World. (features/support/searchalltrials.js:15:13)
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)

1 scenario (1 failed)
3 steps (1 failed, 1 skipped, 1 passed)
0m02.189s

Was this page helpful?
0 / 5 - 0 ratings