All,
I am using clickAndWait xpath=//button[contains(.,'Next')], it does show when i click find on Selenium IDE but doesn't click on the Button. The button has id = pmc_wizard_next and class = btn btn-next.
The html for the button is:
<div id="pmc_wizard" class="wizard pmc-wizard">
<ul class="steps pmc-wizard-steps"> … </ul>
<div class="actions pmc-wizard-actions">
<button id="pmc_wizard_prev" class="btn btn-prev"> … </button>
<button id="pmc_wizard_next" class="btn btn-next" data-last="Submit">
Next
<i class="icon-arrow-right"></i>
</button>
</div>
</div>
In my case, when the button is clicked it doesn't navigate it to the next page however it does perform all the actions on the next page.
Thanks.
clickAndWait generally gives the timeout error . you can either use
click|target|
waitForElementPresent|the next element that could be possibly reached after click|
hope this answer would help you!
Related
I am creating a custom dropdown menu.
The menu contains some items and should remain open when a user clicks on any of these items.
To check if the user clicks inside the dropdown menu I check via window.onclick if event.target.matches('dropdown-content *'). See the snippet below for context.
<div id="myDropdown" class="dropdown-content">
<div class="dropdown-grid">
<div class="add-offset">
<div class="dd-header">
<div (click)="setupNewCol()"><i class="fas fa-plus plus-sign"></i></div>
</div>
</div>
</div>
</div>
This works, but when I add *ngIf to the div with the function call the CSS selector 'dropdown-content *' doesn't seem to work anymore.
This is the HTML with the *ngIf
<div id="myDropdown" class="dropdown-content">
<div class="dropdown-grid">
<div class="add-offset">
<div class="dd-header">
<div *ngIf="!settingNewOffset; else offsetSelection" (click)="setupNewCol()"><i class="fas fa-plus plus-sign"></i></div>
<ng-template #offsetSelection>
<div (click)="addCol()">
CLICK ME
</div>
</ng-template>
</div>
</div>
</div>
</div>
With the introduction of the *ngIf in combination with ng-template the CSS selector doesn't recognize the clicks to be part of '.dropdown-content *' anymore. Why is this and what is a solution to this problem?
Why it won't register the click on target 'dropdown-content' is probably because now the clicked target is a div, that does not have 'dropdown-content'. Probably the target parent has that class, but not the target.
To check if a user clicks on any of the items. You already have methods addCol() or setupNewCol(). If this method runs then user has clicked some of the item where the method was attached. You could also just attach another method to the item e.g (click)="addCol(); onItemClick($event)"
onItemClick(event:any) {
console.log(event)
}
I don't see where the menu closing part is but using onItemClick you could just cancel that or try to cancel the event from propagating at all.
(click)="addCol(); event.stopPropagation()"
I am trying to web scrape with the following HTML by clicking on a button:
I have tried appIE.document.getElementById("btnAddFruit").click
<button type="button"
data-toggle="modal" data-target="#secondary-dialog"
id="btnAddFruit"
class="edt btn btn-red pull-right margin-left-10">
<span class="glyphicon glyphicon-plus-sign">
</span> Fruits</button>
The IE also does not show the pop up window.
Any help is much appreciated.
Edit: I made a typo on the ID and have corrected it
I am confused as the id shown is btnAddFruit
ie.document.querySelector("#btnAddFruit").click
Which is equivalent to
ie.document.getElementById("btnAddFruit").click
Otherwise, please detail what the error message is and on which line (show more of your code as well would help)
I would like to know how to navigate to a different page based on a value in html/Angular 2. If the value is true, then a specific page will load. I already have buttons that use routerLink to navigate to different pages - I would like to replicate that functionality but instead of using a button, pages will load whenever a specific value is true.
Here is my main app html page:
<p-toolbar>
<div class="ui-toolbar-group-left">
<button pButton type="button" label="Home" routerLink="/"></button>
</div>
<div class="ui-toolbar-group-right">
<button pButton type="button" label="About" routerLink="/about"></button>
<button pButton type="button" label="Page1" routerLink="/page1"></button>
<button pButton type="button" label="Page2" routerLink="/page2"></button>
<i class="fa fa-bars"></i>
</div>
</p-toolbar>
<br />
<!--Implement page routing here...-->
<div *ngIf="valueCheckComplete">
<div *ngIf="showPage1"></div>
<div *ngIf="showPage2"></div>
</div>
In the bottom portion you can see where the value checks are occurring. How would I load a page if for example showPage1 were true? All of the functionality that handles these values is already implemented in my TypeScript file, I just need to know how to navigate to a different page based on a value, not a button click.
Figured it out. Instead of routing to the page in my html page, I used a Router object in my typescript file.
constructor(private router: Router, ...){
// set boolean here
}
goToPage()
{
if(this.showTuner)
this.router.navigate(['/tuner']);
else if(this.showProcessor)
this.router.navigate(['/processor']);
}
I have this button on my website which I am using to redirect to another page when clicked using the onclick function. The problem is, when it is clicked, it just shows the 404 page? Any ideas why this is happening?
<button class="btn btn-sm btn-badge" type="button" onclick="location.href = 'user_page.php&show=1?badge=Available';"><i class="fa fa-sort" style="color:#963"></i> Available </button>
It seems like you have your link incorrect - it should be ? first and then &.
Like this:
user_page.php?show=1&badge=Available
That should then solve your problem.
Try this :
onclick="javascript:location.href='user_page.php&show=1?badge=Available'"
I am trying to make a lightbox appear when a button is pushed. Problem is, when the anchor is around the button (like in the code below), it automatically redirects to "mywebsite.com/myimage.jpg". However when the anchor is inside, only clicking the text will pop the lightbox. Here is the code:
<a href="myimage.jpg" rel="lightbox" title="Title!" style="color:white" class="lightbox">
<div>
<button class="btn btn-lg btn-block" style="background:red">Button Text!</button>
</div>
</a>
Anchors and buttons have two different intended purposes, though Bootstrap allows you to style either as a button. Pick one. Using both is just bad practice.
<a href="myimage.jpg" rel="lightbox" title="Title!"
class="lightbox btn btn-danger btn-lg btn-block my-button-class">Button Text!</a>
The .btn-danger variant gets you the white-on-red scheme you seem to be going for. See http://getbootstrap.com/css/#buttons-options.
If this doesn't solve your problem you'll need to be more clear about which lightbox plugin you're using and what properties it's looking for.