Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dahumadasg opened this issue Apr 14, 2017 · 3 comments

Comments

@dahumadasg
Copy link

dahumadasg commented Apr 14, 2017

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

  • WebdriverIO version:4.6.2

  • Node.js version:4.2.6

  • [Standalone mode ]

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>

@christian-bromann
Copy link
Member

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.

@christian-bromann
Copy link
Member

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

@neville4529
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants