Asked  7 Months ago    Answers:  5   Viewed   31 times

While finding the relative XPath via Firebug : it creates like

  1. .//*[@id='Passwd']--------- what if we dont use dot at the start what it signifies?

  2. Just add //* in the Xpath -- it highlights --- various page elements ---------- what does it signify?

Below are XPaths for Gmail password fields. What is significance of * ?

  • .//*[@id='Passwd']

  • //child::input[@type='password']

 Answers

81

These expressions all select different nodesets:

.//*[@id='Passwd']

The '.' at the beginning means, that the current processing starts at the current node. The '*' selects all element nodes descending from this current node with the @id-attribute-value equal to 'Passwd'.

What if we don't use dot at the start what it signifies?

Then you'd select all element nodes with an @id-attribute-value equal to 'Passwd' in the whole document.

Just add //* in the XPath -- it highlights --- various page elements

This would select all element nodes in the whole document.

Below mentioned : XPatht's for Gmail Password field are true what is significance of * ?

.//*[@id='Passwd']

This would select all element nodes descending from the current node which @id-attribute-value is equal to 'Passwd'.

//child::input[@type='password']

This would select all child-element nodes named input which @type-attribute-values are equal to 'password'. The child:: axis prefix may be omitted, because it is the default behaviour.

The syntax of choosing the appropriate expression is explained here at w3school.com.

And the Axes(current point in processing) are explained here at another w3school.com page.

Tuesday, June 1, 2021
 
kwhohasamullet
answered 7 Months ago
81

If you want to re-draw your view from the UI thread you can call invalidate() method.

If you want to re-draw your view from a non-UI thread you can call postInvalidate() method.

Each class which is derived from the View class has the invalidate and the postInvalidate method. If invalidate gets called it tells the system that the current view has changed and it should be redrawn as soon as possible. As this method can only be called from your UI thread another method is needed for when you are not in the UI thread and still want to notify the system that your View has been changed. The postInvalidate method notifies the system from a non-UI thread and the view gets redrawn in the next event loop on the UI thread as soon as possible. It is also shortly explained in the SDK documentation:

CLICK HERE

UPDATE:

There are some problems that arise when using postInvalidate from other threads (like not having the UI updated right-away), this will be more efficient:

runOnUiThread(new Runnable() {
    public void run() {
    myImageView.setImageBitmap(image);
    imageView.invalidate();
    }
});
Monday, August 9, 2021
 
jdmcbr
answered 4 Months ago
66

There is essentially no difference, only a TextView has the width property also.

TextView.setWidth

Sunday, August 22, 2021
 
muaaz
answered 4 Months ago
100

As per your statement I would want not to have value in executeScript, but java variable you can reference the Sting value through a Java variable :

String myValue = "80120804076";
WebElement pesel = driver.findElement(fldPesel);
jse.executeScript("arguments[0].value='" + myValue + "';", pesel);
Monday, August 30, 2021
 
ShadowZzz
answered 4 Months ago
95

I had the same problem and I was able to solve it by using the robot, creating function for the url and passing it to a different thread.

    Runnable mlauncher = () -> {
    try {

      driver.get(url);
     } catch (Exception e) {
          e.printStackTrace();
       }
    };

public void myfunction {
 try {

   Thread mthread = new Thread(mlauncher);
   mthread.start

  robot.keyPress(KeyEvent.VK_ENTER);
  robot.keyRelease(KeyEvent.VK_ENTER);

 } catch (Exception e) {
          e.printStackTrace();
       }
Tuesday, September 28, 2021
 
Seibar
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share