File tree Expand file tree Collapse file tree 4 files changed +15
-4
lines changed
bellatrix.playwright/src/main/java/solutions/bellatrix/playwright
bellatrix.web/src/main/java/solutions/bellatrix/web Expand file tree Collapse file tree 4 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ public NavigationService navigate() {
3636 return SingletonFactory .getInstance (NavigationService .class );
3737 }
3838
39- public String getUrl () {
39+ protected String getUrl () {
4040 return "" ;
4141 }
4242
Original file line number Diff line number Diff line change 1414package solutions .bellatrix .playwright .services ;
1515
1616import com .google .common .base .Strings ;
17+ import lombok .SneakyThrows ;
1718import solutions .bellatrix .core .utilities .SingletonFactory ;
1819import solutions .bellatrix .playwright .pages .WebPage ;
1920
21+ import java .lang .reflect .Method ;
2022import java .net .MalformedURLException ;
2123import java .net .URL ;
2224import java .net .URLDecoder ;
2931
3032@ SuppressWarnings ("ALL" )
3133public class NavigationService extends WebService {
34+ @ SneakyThrows
3235 public void to (WebPage page ) {
33- wrappedBrowser ().getCurrentPage ().navigate (page .getUrl ());
36+ Method method = page .getClass ().getDeclaredMethod ("getUrl" );
37+ method .setAccessible (true );
38+ wrappedBrowser ().getCurrentPage ().navigate ((String )method .invoke (page ));
3439 }
3540
3641 public void to (String url ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public NavigationService navigate() {
4444 return new NavigationService ();
4545 }
4646
47- public String getUrl () {
47+ protected String getUrl () {
4848 return "" ;
4949 }
5050
Original file line number Diff line number Diff line change 1414package solutions .bellatrix .web .services ;
1515
1616import com .google .common .base .Strings ;
17+ import lombok .SneakyThrows ;
1718import org .openqa .selenium .TimeoutException ;
1819import org .openqa .selenium .support .ui .WebDriverWait ;
1920import solutions .bellatrix .core .configuration .ConfigurationService ;
2021import solutions .bellatrix .web .configuration .WebSettings ;
2122import solutions .bellatrix .web .pages .WebPage ;
2223
24+ import java .lang .reflect .Method ;
2325import java .net .MalformedURLException ;
2426import java .net .URL ;
2527import java .net .URLDecoder ;
@@ -38,8 +40,12 @@ public void to(String url) {
3840 getWrappedDriver ().navigate ().to (url );
3941 }
4042
43+ @ SneakyThrows
4144 public void to (WebPage page ) {
42- getWrappedDriver ().navigate ().to (page .getUrl ());
45+ Method method = page .getClass ().getDeclaredMethod ("getUrl" );
46+ method .setAccessible (true );
47+
48+ getWrappedDriver ().navigate ().to ((String )method .invoke (page ));
4349 }
4450
4551 public void toLocalPage (String filePath ) {
You can’t perform that action at this time.
0 commit comments