selenium webdriver - return value false from isDisplayed method -


  बूलीयन पाठ = ड्राइवर.फिक्स एलेमेंट (by.cssSelector ("। sr_ctext> gt; b"))। isDisplayed () ; Println (पाठ);   

जब कभी .sr_ctext & gt; b नहीं मिला है, सूट बंद हो जाता है और जब तत्व सफलतापूर्वक मिल जाता है तो true वापस आ जाता है। / p>

मुझे लगता है कि जब तत्व नहीं मिला है, तो इसे टेक्स्ट वैरिएबल में गलत होना चाहिए न कि कोड को रोकना।

फिर आपको पहले चरण में वेब एलेमेंट मिलना चाहिए और केवल यदि आप एक परिणाम प्राप्त करते हैं तो डिस्प्लेड की जांच करें, जो शून्य नहीं है एक और समाधान एक प्रयास / पकड़ ब्लॉक में अपना कोड डालना होगा:

  बूलीयन पाठ; {text = driver.findElement (by.cssSelector ("। sr_ctext> gt" बी) देखें)। isDisplayed (); } पकड़ (नोएसचएलिमेंट अपवाद ई) {text = false; } System.out.println (टेक्स्ट);    

Comments

Popular posts from this blog

mysql - where clause in inner join query -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -