Selecting a radio button in Codeception - codeception

Any suggestions on how I would select one of these?

You could try to get it via the XPath, just use
$I->click('//*[#class="checkout-shipping-method-item"]/input[1]');

Related

Unable to select drop down button for python selenium

How would I select this button
and click on it?
I have tried several methods and none of them have clicked it.
try with css selector and javaScript executor for select multi-class element and click it
driver.execute_script("document.querySelector('button.btn-select.nowrap-line')[0].click()")
Have you tried the class_name selector?
element = driver.find_element_by_class_name("btn-select nowrap-line")
I know you said you've tried several methods, maybe list the different ways and I can probably try to see why it's failing

How to handle dynamic id

I am trying to explore log In button xpath with this site https://www.componence.com/login, by just recording and play back.Then I tried to get it through firepath and chrome browser default xpath copier.
But it looks like every time submit button xpath get changed with page load. I got following xpath for "Sign IN" button.
.//*[#id='yui_patched_v3_11_0_1_1487250469606_202']
.//*[#id='yui_patched_v3_11_0_1_1487251369606_202']
.//*[#id='yui_patched_v3_11_0_1_1487250229606_202']
.//*[#id='yui_patched_v3_11_0_1_1487254369606_202']
Can you please help me to retrieve correct xpath of Sign IN button which I can use with selenium IDE?
You can use below XPath to handle dynamic id:
//button[starts-with(#id, "yui_patched_v3_11_0_1_")]
But better solution is to use text content of element:
//button[normalize-space(text())="Sign In"]
I will have to disagree with the second statement of #Andersson, since it will work for .com but not for .nl.
As I see the site has a second language and my opinion is to avoid using selectors based on text on a multi-language environment.
Also as I see the id seems does not have a meaningful value, in this case try to identify a unique parent section and go from there.
One option for css/xpath would be:
css: form.sign-in-form button
xpath: //form[contains(#class, 'sign-in-form')]//button

Click Button With No ID Selenium Java

Apologies for this;
Event Triggers
Photos
Push Notifications
How can I Click on Event triggers for example using Selenium Java?
I've tried this code:
By.xpath("//button[contains(text(),'Event triggers')]");
By.xpath("//button[contains(text(),'Submit')]");
I tried this as well:
WebElement Box= driver.findElement(By.tagName("Event triggers"));
Box.submit();
Neither of these worked...
Thank you
Try to using this:
By.xpath("//a[contains(text(),'Event triggers')]");
instead of
By.xpath("//button[contains(text(),'Event triggers')]");
Based on the page source mentioned in the comment I think Event Triggers is not a button but an tag which essentially makes it a link.
As you know the text of the link you are trying to click you can always use:
driver.findElement(By.linkText("Event Triggers"));
to get Event Triggers web element.
Using xpath should be avoided due to slow performance.
Well, if button doesnt have any id , you can try to write dynamic xpath by using "class name" and "type" (there are plenty of examples , you can learn easily how to create your xpath) , or easiest way, use firebug to locate element that you want to click and copy exact Xpath via firebug. And then click.
The correct answer is:
By.xpath("//button[contains(text(),'Event triggers')]").click();
You were missing that click action.

click on submit button not working in selenium webdriver

I trying to click on the create account button in registration form.
this is how the button locate in the html page:
<div id="submitContainer"><button type="submit" class="large"><span><strong> Create Account </strong></span></button></div>
this is the button xpath:
//*[#id="submitContainer"]/button/span/strong
the problem is that the button don't have id, he locate inside a div.
I try to use by id,xpath,css,name, but all of this not working:
driver.findElement(By.id("submitContainer")).click();
driver.findElement(By.xpath("//*[#id='submitContainer']/button/span/strong")).click();
driver.findElement(By.tagName("Create Account")).click();
driver.findElement(By.className("large")).click();
thanks!
In your examples, except for the last one, you are not targeting the button. Now your last example, should actually locate the button-element:
driver.findElement(By.className("large")).click();
Could you please post the error message you are getting?
Are there more than one element on the page with className "large"?
Make sure the button is in view window, if it is then try clicking on it. Try to wait for the element to load. There might be an issue with your element being loaded into DOM -
driver.wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//button[#type='submit']"))).click();
Hope this helps.
If you want to use xpath, the correct syntax is
//button[#type='submit']
Use this line below:
Thread.sleep(3000);
I got the result once I used this one. Since some time we need to give some sleep time for the site to load fully to pull the Xpath.
You can use the linkText
driver.findElement(By.linkText("Create Account")).click();
Hope it will work for you.

How to add SEARCH BOX using XAML

I have to add a search box, which has dropdown button kind (say it wil have TeamBook and PersonalBook) then when i select TeamBook, the searchbox should get the default data as "SearchTeambook" if not,"SearchpersonalBook".
I have to do this using XAML.
Please help me in doing this.
Thanks
Ramm
I have figured out the better way of solvingthis .
Now i am able to use the feature
Thanks
Ramm