Skip to content

getting this error "org.openqa.selenium.JavascriptException: javascript error: angular is not defined" #117

Description

@suhailsqm

I have used the below code at which i am getting the error. I am running using java, selenium and testng framework.

WebElement stateSelect = driver.findElement(ByAngular.withRootSelector(""app-create-customers"").model("state"))

Please find the error in the below logs.
Issue Logs.txt;

I have chosen the right root selector and also the model.

My Html doc in angular app looks like so.

        <div class="col-md-6">
          <div class="form-group">
            <label for="userinput4">State<span style="color:red">*</span></label>
            <ng-select [(ngModel)]="state" (change)="onSelectState()">
              <ng-option value="KARNATAKA">KARNATAKA</ng-option>
              <ng-option value="TAMIL NADU">TAMIL NADU</ng-option>
              <ng-option value="ANDHRA PRADESH">ANDHRA PRADESH</ng-option>
            </ng-select>
          </div>
        </div>

On inspecting the web element the html code looks something like this, which seems that i have chosen the right root selector.

...

I have very little knowledge in angular and started automating a website for the first time in selenium.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions