Answer the question
In order to leave comments, you need to log in
How to pass the value of a variable from one class to another?
There are 2 classes: A and B. It is necessary to transfer the value of a variable from class A to class B.
This variable in class A is in the form of xpath. Those. we get it on the page of class A, and if we try to get it again in class B, an error will occur (the element will not be found).
Can you please tell me how you can pass the value already received in class A, without re-requesting the element in class B?
Answer the question
In order to leave comments, you need to log in
class A {
private String xPath;
...
public String getXPath() {
return this.xPath;
}
}
class B {
private A a;
...
void someVoid() {
...
String xPath = a.getXPath();
...
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question