Note that there are some explanatory texts on larger screens.

plurals
  1. POPython : NameError: global name 'GetText' is not defined
    text
    copied!<p>I have been stuck with this error for a couple of hours now. Not sure what is wrong. Below is the piece of code</p> <blockquote> <p>NameError: global name 'GetText' is not defined</p> </blockquote> <pre><code>class BaseScreen(object): def GetTextFromScreen(self, x, y, a, b, noofrows = 0): count = 0 message = "" while (count &lt; noofrows): line = Region(self.screen.x + x, self.screen.y + y + (count * 20), a, b) message = message + "\n" + line.text() count += 1 return message class HomeScreen(BaseScreen): def GetSearchResults(self): if self.screen.exists("Noitemsfound.png"): return 'No Items Found' else: return self.GetTextFromScreen(36, 274, 680, 20, 16) class HomeTests(unittest.TestCase): def test_001S(self): Home = HomeScreen() Home.ResetSearchCriteria() Home.Search("0009", "Key") self.assertTrue("0009" in Home.GetSearchResults(), "Key was not returned") </code></pre> <p><code>Basescreen</code> class has all the reusable methods applicable across different screens.<br> <code>Homescreen</code> inherits <code>Basescreen</code>.<br> In <code>HomeTests</code> test case class, the last step is to <code>Home.GetSearchResults()</code> which in turn calls a base class method and the error. </p> <p>Note:<br> I have another screenclass and testcaseclass doing the same which works without issues.</p> <p>I have checked all the importing statements and is ok</p> <p>'GetText' in the error message is the name of method initially after which i changed it to <code>GetTextFromScreen</code></p> <p>Error message is still pointing to a line 88 in code which is not there any more. Module import/reloading issue?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload