-
Notifications
You must be signed in to change notification settings - Fork 3
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
Initializing seleniumJavaExperiment #12
base: master
Are you sure you want to change the base?
Conversation
Creating project structure, dependencies and first test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isramodus there are a few files under ".idea" folder, could you take a look them, please
Solving PR comments. Addressed in .gitignore file
First PR of clicking checkbox using Selenium
Completed automation of checkbox selection and assertion.
dropdownpage.openDropDown(); | ||
dropdownpage.selectOptions("Option 2"); | ||
dropdownpage.openDropDown(); | ||
System.out.println(dropdownpage.returnDropdownValue()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid logs if possible.
return pageTitle.getText(); | ||
} | ||
|
||
public void openDropDown(){dropdown.click();} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using select, you do not need to open the dropdown. You can directly use select.
Select opt= new Select(dropdown); | ||
WebElement dropdownx= opt.getFirstSelectedOption(); | ||
String value= dropdownx.getText(); | ||
return value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the indentations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenil-fadia I'll connect with you to help me out with this.
|
||
} | ||
|
||
public String returnDropdownValue(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Accept the web Element as a parameter.
|
||
@BeforeClass | ||
public void beforeClass () { | ||
System.setProperty("webdriver.chrome.driver", "./src/test/resources/chromedriver/chromedriver.exe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make use of webdriver binaries -
Automatically download WebDriver Binaries
Let me know if you need any help here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenil-fadia I need your help to resolve this.
} | ||
|
||
@Test(priority = 2) | ||
public void clickCheckboxes(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the tests should be independent of each other.
return pageTitle.getText(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove unwanted line breaks.
|
||
|
||
public void clickCheckbox(){ | ||
check1.click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix the indentation
navigateBackHome(); | ||
homePage.clickOption("Checkboxes"); | ||
Assert.assertEquals("Checkboxes", checkboxesPage.getTitleText()); | ||
Thread.sleep(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a demo repo it's not critical, but we should avoid these when possible.
public void clickCheckbox(){ | ||
check1.click(); | ||
} | ||
|
||
public boolean getCheckboxState1(){return check1.isSelected();} | ||
|
||
public void unclickSecondCheckbox(){check2.click();} | ||
|
||
public boolean getCheckboxState2(){return check2.isSelected();} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, not critical for a demo repo, but for the next iteration we could refactor these because a lot of the code is repeating.
Overall, it looks good. Left 2 remarks. Nothing to add to what's been already pointed out. |
Creating project structure, dependencies and first test
https://moduscreate.atlassian.net/browse/QACOE-244