When I scroll with the code below, it scrolls very slowly, how can I speed it up?
public WebElement scrollToElement() {
return getDriver().findElement(AppiumBy.androidUIAutomator(
"new UiScrollable(new UiSelector().resourceId(\"tv_today_campaigns\")).scrollIntoView(new UiSelector().text(\"Kampanyalar ve Duyurular\"))"));
}
Related
I wrote a software for handling Pizza Payments as a school project. For this I create a custom row as a Anchorpane. After loading a few Entries from a MySQL DB, the ListView for showing the possible Pizzas to choose is struggling (showing white space above and under the entries, where the other Entries should be displayed but aren't).
If you want to see the main Pane FXML click here, if you want to see the Custom ListCell Anchorpane just click here.
To see the error visually just click here
Because I have no idea how this custom cells are rendered in detail I have no idea where the error is, so I tried nothing to fix it.
//the adding a new Pizza Row method in the WindowController Class for the main window
private void addPizzaRow(Pizza pizza) {
try {
FXMLLoader loader = new FXMLLoader(new File(WindowController.ROW_FXML).toURI().toURL());
pizzenContr = new RowPizzasController();
loader.setController(pizzenContr);
Pane rootPane = loader.load();
// initialize tab controller
pizzenContr.init(pizza);
this.pizzenListview.getItems().add(rootPane);
} catch (IOException e) {
e.printStackTrace();
System.exit(1);
}
}
//the called init() method
public void init(Pizza pizza) {
pizzaImageview.setImage(new Image("Classdependencies/Window/PizzaListViewImg.png"));
//set title and image (icon)
this.pizzaLabel.setText(pizza.getName());
this.kleinButton.setOnAction(new EventHandler<ActionEvent>() {
#Override
public void handle(ActionEvent event) {
}
});
After five or 6 Entries white space above and under the entries is showing, where the other Entries should be displayed but aren't.
Looks like the error had something todo with absolute height I gave the cells Panes after I set this to default in Scenebuilder it worked fine again.
I want to click on expand button to view the menu items.
#Then("^click on set up$")
public void click_on_set_up() throws Throwable {
driver.findElement(By.cssSelector("btn-header pull-right")).click();
}
This code isnot working. Please tell me if there is a way to click on expand and collapse button.
Use action class :-
Actions actions = new Actions(driver);
WebElement mainMenu = driver.findElement(By."Your Locator");
actions.moveToElement(mainMenu);
WebElement subMenu = driver.findElement(By."Your Locator");
actions.moveToElement(subMenu);
actions.click().build().perform();
Hope it will help you :)
I am trying to automate 1 scenario where if I click on button on webpage it opens another tab in the browser. I am trying to move my webdriver to another tab but with no success. And also I want to click on the button which is within iframe.
HEre is my code:
ArrayList<String> tabs2 = new ArrayList<String> (driver.getWindowHandles());
driver.switchTo().window(tabs2.get(2));
driver.switchTo().frame(0);
click(buttonwithiniframe);
Any help is really appreciated!
Try to wait for a new window before switching to it. Moreover, selecting a window by index is not reliable.
This example switches to a newly opened window and set the context on the first frame:
import org.openqa.selenium.support.ui.WebDriverWait;
WebDriverWait wait = new WebDriverWait(driver, 20);
// get the main window handle
String mainHandle = driver.getWindowHandle();
// wait for a new window and switch to it
driver.switchTo().window(wait.until((WebDriver drv)->{
for (String handle : drv.getWindowHandles()){
if (!handle.equals(mainHandle))
return handle;
}
return null;
}));
// set the context on the first frame
driver.switchTo().frame(0);
And to wait for a new window without lambda expression:
// wait for a new window and switch to it
driver.switchTo().window(wait.until(new ExpectedCondition<String>() {
#Override
public String apply(WebDriver drv) {
for (String handle : drv.getWindowHandles()){
if (!handle.equals(mainHandle))
return handle;
}
return null;
}
}));
How to hide a tab bar at bottom.
I used android:windowSoftInputMode="adjustPan|adjustResize". I do not get the desired result. I also added the event bus and when the focus on the edit text disappears tab bar:
public void showTabBar()
{
mTabHost.getTabWidget().setVisibility(View.VISIBLE);
}
public void hideTabBar()
{
mTabHost.getTabWidget().setVisibility(View.GONE);
}
But, it flickers, too, is not suitable. What else can I do?
(source: cs629227.vk.me)
I have the last version of java(8_40) and javaFX.
I have a checkbox with 10 items.
I compile and run the program.
If i move the program window to the bottom of the monitor screen, the dropdown list go out from the monitor screen. It is impossible to click the items out the screen.
Instead, if I try to do the same layout with scenes builder 2.0, click on preview, the dropdown is moved automatically up for not exit the screen.
Why with scenes builder is properly displayed, instead with "compile and run" not?
The problem is the same that if I do graphics via code is that if I use the files fxml.
I put below a small program example that gives me this error:
Component CustomControl.java
public class CustomControl extends VBox {
public CustomControl() {
ComboBox<String> asd = new ComboBox<String>();
ObservableList<String> data = FXCollections.observableArrayList();
asd.setItems(data);
data.add("1");
data.add("2");
data.add("3");
data.add("4");
data.add("5");
data.add("6");
data.add("7");
data.add("8");
data.add("9");
data.add("10");
getChildren().add(asd);
}
}
Main.java
public class CustomControlExample extends Application {
public static void main(String[] args) {
launch(args);
}
String address = " ";
#Override public void start(Stage stage) {
stage.setTitle("ComboBoxSample");
Scene scene = new Scene(new CustomControl());
stage.setScene(scene);
stage.show();
}
}
EDIT:
Screen-shot on the left the pop-up go out of the screen border (eclipse)
While, on the right the pop-up is automatically moved (Scene builder)
See this image:
It is easy to solve, just change the visible row count.